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:51:36 -0400
commitaf44641c5511d35889fa4c25ffda0d2aa8eb4be6 (patch)
treed7fc5e8d5f3ea6dd5011c5e6235e5c338130b201
parent2619beee7c16b9de80ee30dd9593bbdf50d2adb0 (diff)
downloadbcfg2-af44641c5511d35889fa4c25ffda0d2aa8eb4be6.tar.gz
bcfg2-af44641c5511d35889fa4c25ffda0d2aa8eb4be6.tar.bz2
bcfg2-af44641c5511d35889fa4c25ffda0d2aa8eb4be6.zip
FileProbes creates new entries in Cfg (https://github.com/Bcfg2/bcfg2/issues/38)
-rw-r--r--src/lib/Bcfg2/Server/Plugins/FileProbes.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/FileProbes.py b/src/lib/Bcfg2/Server/Plugins/FileProbes.py
index a403c78d7..3d6c190a5 100644
--- a/src/lib/Bcfg2/Server/Plugins/FileProbes.py
+++ b/src/lib/Bcfg2/Server/Plugins/FileProbes.py
@@ -46,7 +46,6 @@ class FileProbes(Bcfg2.Server.Plugin.Plugin,
the client """
name = 'FileProbes'
- experimental = True
__author__ = 'chris.a.st.pierre@gmail.com'
def __init__(self, core, datastore):
@@ -114,12 +113,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
@@ -132,7 +132,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" %