summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2011-12-28 12:36:34 -0500
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2011-12-28 12:37:16 -0500
commit4b44aab4ed8ef39b15ea4f7a1ebb648ec95642fb (patch)
treed1205fa7942d83e563d0318c177d8467b2f24e27 /src/lib
parent51f6154343434f1ac31e7d965b2f904437ea96d3 (diff)
downloadbcfg2-4b44aab4ed8ef39b15ea4f7a1ebb648ec95642fb.tar.gz
bcfg2-4b44aab4ed8ef39b15ea4f7a1ebb648ec95642fb.tar.bz2
bcfg2-4b44aab4ed8ef39b15ea4f7a1ebb648ec95642fb.zip
fixed FileProbes handling of base64-encoded files
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Server/Plugins/FileProbes.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/lib/Server/Plugins/FileProbes.py b/src/lib/Server/Plugins/FileProbes.py
index d761d23d2..0c1a0d897 100644
--- a/src/lib/Server/Plugins/FileProbes.py
+++ b/src/lib/Server/Plugins/FileProbes.py
@@ -132,6 +132,12 @@ class FileProbes(Bcfg2.Server.Plugin.Plugin,
except Bcfg2.Server.Plugin.PluginExecutionError:
create = True
+ # get current entry data
+ if entry.get("encoding") == "base64":
+ entrydata = binascii.a2b_base64(entry.text)
+ else:
+ entrydata = entry.text
+
if create:
self.logger.info("Writing new probed file %s" % fileloc)
try:
@@ -170,14 +176,14 @@ class FileProbes(Bcfg2.Server.Plugin.Plugin,
except Bcfg2.Server.Plugin.PluginExecutionError:
pass
tries += 1
- elif entry.data == contents:
+ elif entrydata == contents:
self.logger.debug("Existing %s contents match probed contents" %
filename)
return
elif (entry.get('update', 'false').lower() == "true"):
self.logger.info("Writing updated probed file %s" % fileloc)
open(fileloc, 'wb').write(contents)
-
+
# service FAM events
tries = 0
updated = False
@@ -187,14 +193,18 @@ class FileProbes(Bcfg2.Server.Plugin.Plugin,
raise Bcfg2.Server.Plugin.PluginExecutionError
self.core.fam.handle_events_in_interval(1)
cfg.entries[filename].bind_entry(entry, metadata)
- if entry.text == contents:
+ # get current entry data
+ if entry.get("encoding") == "base64":
+ entrydata = binascii.a2b_base64(entry.text)
+ else:
+ entrydata = entry.text
+ if entrydata == contents:
updated = True
tries += 1
else:
self.logger.info("Skipping updated probed file %s" % fileloc)
return
-
-
+
def write_infoxml(self, infoxml, entry, data):
""" write an info.xml for the file """
self.logger.info("Writing info.xml at %s for %s" %