summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-08-15 11:51:36 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-08-15 11:53:57 -0400
commit6cc1ede5cba4a27871ece2cbdab4ebc93c00fb4c (patch)
tree4aa4d5ca0a7c38538929523f96e1c376e2bc9ca3
parent94d1f534f4eec61af0def1116aed7841f4136969 (diff)
downloadbcfg2-6cc1ede5cba4a27871ece2cbdab4ebc93c00fb4c.tar.gz
bcfg2-6cc1ede5cba4a27871ece2cbdab4ebc93c00fb4c.tar.bz2
bcfg2-6cc1ede5cba4a27871ece2cbdab4ebc93c00fb4c.zip
FileProbes creates new entries in Cfg (https://github.com/Bcfg2/bcfg2/issues/38)
-rw-r--r--src/lib/Server/Plugins/FileProbes.py8
1 files 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" %