summaryrefslogtreecommitdiffstats
path: root/src/lib/Client/Tools/POSIX.py
diff options
context:
space:
mode:
authorHolger Weiß <holger@zedat.fu-berlin.de>2011-06-29 15:55:45 +0200
committerHolger Weiß <holger@zedat.fu-berlin.de>2011-06-29 15:55:45 +0200
commita702a5ee53ae8cb5870844237fe88c55dac97734 (patch)
tree1147fc413cf4e720a5512212cca4046b7637a380 /src/lib/Client/Tools/POSIX.py
parent53d46e336d3514ec50f85e5db4ceed16590bf154 (diff)
downloadbcfg2-a702a5ee53ae8cb5870844237fe88c55dac97734.tar.gz
bcfg2-a702a5ee53ae8cb5870844237fe88c55dac97734.tar.bz2
bcfg2-a702a5ee53ae8cb5870844237fe88c55dac97734.zip
New Info attribute: "sensitive"
The contents/diffs of <Path>s which are marked as "sensitive" are now omitted from the reports transmitted to the server, so that they won't end up in the statistics database.
Diffstat (limited to 'src/lib/Client/Tools/POSIX.py')
-rw-r--r--src/lib/Client/Tools/POSIX.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/lib/Client/Tools/POSIX.py b/src/lib/Client/Tools/POSIX.py
index faec2e251..f16b714ff 100644
--- a/src/lib/Client/Tools/POSIX.py
+++ b/src/lib/Client/Tools/POSIX.py
@@ -148,7 +148,8 @@ class POSIX(Bcfg2.Client.Tools.Tool):
entry.set('perms', str(oct(ondisk[ST_MODE])[-4:]))
try:
content = open(entry.get('name')).read()
- entry.set('current_bfile', binascii.b2a_base64(content))
+ if (entry.get('sensitive') not in ['true', 'True']):
+ entry.set('current_bfile', binascii.b2a_base64(content))
except IOError:
error = sys.exc_info()[1]
self.logger.error("Failed to read %s: %s" % (error.filename,
@@ -482,7 +483,8 @@ class POSIX(Bcfg2.Client.Tools.Tool):
contentStatus = content == tempdata
if not contentStatus:
if tbin or not isString(content, self.setup['encoding']):
- entry.set('current_bfile', binascii.b2a_base64(content))
+ if (entry.get('sensitive') not in ['true', 'True']):
+ entry.set('current_bfile', binascii.b2a_base64(content))
nqtext = entry.get('qtext', '')
nqtext += '\nBinary file, no printable diff'
else:
@@ -504,8 +506,9 @@ class POSIX(Bcfg2.Client.Tools.Tool):
do_diff = False
break
if do_diff:
- diff = '\n'.join(rawdiff)
- entry.set("current_bdiff", binascii.b2a_base64(diff))
+ if (entry.get('sensitive') not in ['true', 'True']):
+ diff = '\n'.join(rawdiff)
+ entry.set("current_bdiff", binascii.b2a_base64(diff))
# entry.set("current_diff", diff)
udiff = '\n'.join([x for x in \
difflib.unified_diff(content.split('\n'), \
@@ -521,7 +524,8 @@ class POSIX(Bcfg2.Client.Tools.Tool):
nqtext += '\n'
nqtext += dudiff
else:
- entry.set('current_bfile', binascii.b2a_base64(content))
+ if (entry.get('sensitive') not in ['true', 'True']):
+ entry.set('current_bfile', binascii.b2a_base64(content))
nqtext = entry.get('qtext', '')
nqtext += '\nDiff took too long to compute, no printable diff'
entry.set('qtext', nqtext)