summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Plugins/FileProbes.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/Server/Plugins/FileProbes.py')
-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" %