From 6cc1ede5cba4a27871ece2cbdab4ebc93c00fb4c Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Wed, 15 Aug 2012 11:51:36 -0400 Subject: FileProbes creates new entries in Cfg (https://github.com/Bcfg2/bcfg2/issues/38) --- src/lib/Server/Plugins/FileProbes.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/Server/Plugins/FileProbes.py b/src/lib/Server/Plugins/FileProbes.py index 2332a1d40..5dcf4c613 100644 --- a/src/lib/Server/Plugins/FileProbes.py +++ b/src/lib/Server/Plugins/FileProbes.py @@ -56,7 +56,6 @@ class FileProbes(Bcfg2.Server.Plugin.Plugin, name = 'FileProbes' experimental = True - __version__ = '$Id$' __author__ = 'chris.a.st.pierre@gmail.com' def __init__(self, core, datastore): @@ -122,12 +121,13 @@ class FileProbes(Bcfg2.Server.Plugin.Plugin, specific = "%s.H_%s" % (os.path.basename(filename), metadata.hostname) # we can't use os.path.join() for this because specific # already has a leading /, which confuses os.path.join() - fileloc = "%s%s" % (cfg.data, os.path.join(filename, specific)) + fileloc = os.path.join(cfg.data, + os.path.join(filename, specific).lstrip("/")) create = False try: cfg.entries[filename].bind_entry(entry, metadata) - except Bcfg2.Server.Plugin.PluginExecutionError: + except KeyError, Bcfg2.Server.Plugin.PluginExecutionError: create = True # get current entry data @@ -140,7 +140,7 @@ class FileProbes(Bcfg2.Server.Plugin.Plugin, self.logger.info("Writing new probed file %s" % fileloc) self.write_file(fileloc, contents) self.verify_file(filename, contents, metadata) - infoxml = os.path.join("%s%s" % (cfg.data, filename), "info.xml") + infoxml = os.path.join(cfg.data, filename.lstrip("/"), "info.xml") self.write_infoxml(infoxml, entry, data) elif entrydata == contents: self.debug_log("Existing %s contents match probed contents" % -- cgit v1.2.3-1-g7c22