summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Plugins/Cfg.py
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2007-08-01 14:22:32 +0000
committerNarayan Desai <desai@mcs.anl.gov>2007-08-01 14:22:32 +0000
commit867b093e26069de43268e424dc673d1242f6380d (patch)
treea34227e283b174485738151dc543324286597b9f /src/lib/Server/Plugins/Cfg.py
parent27f130ee295c6469c74d172fe08ac310046c5d2c (diff)
downloadbcfg2-867b093e26069de43268e424dc673d1242f6380d.tar.gz
bcfg2-867b093e26069de43268e424dc673d1242f6380d.tar.bz2
bcfg2-867b093e26069de43268e424dc673d1242f6380d.zip
Fix binary config file stats upload
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@3589 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Plugins/Cfg.py')
-rw-r--r--src/lib/Server/Plugins/Cfg.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/lib/Server/Plugins/Cfg.py b/src/lib/Server/Plugins/Cfg.py
index ad1711d01..207f4465f 100644
--- a/src/lib/Server/Plugins/Cfg.py
+++ b/src/lib/Server/Plugins/Cfg.py
@@ -10,12 +10,6 @@ specific = re.compile('(.*/)(?P<filename>[\S\-.]+)\.((H_(?P<hostname>\S+))|' +
'(G(?P<prio>\d+)_(?P<group>\S+)))$')
probeData = {}
-def update_file(path, diff):
- '''Update file at path using diff'''
- newdata = '\n'.join(difflib.restore(xml.sax.saxutils.unescape(diff).split('\n'), 1))
- print "writing file, %s" % path
- open(path, 'w').write(newdata)
-
class SpecificityError(Exception):
'''Thrown in case of filename parse failure'''
pass
@@ -362,7 +356,7 @@ class Cfg(Bcfg2.Server.Plugin.Plugin):
logger.error("Got unknown event %s %s:%s" % (action, event.requestID, event.filename))
self.interpolate = len([entry for entry in self.entries.values() if entry.interpolate ]) > 0
- def AcceptEntry(self, meta, _, entry_name, diff):
+ def AcceptEntry(self, meta, _, entry_name, diff, fulldata):
'''per-plugin bcfg2-admin pull support'''
hsq = "Found host-specific file %s; Should it be updated (n/Y): "
repo_vers = lxml.etree.Element('ConfigFile', name=entry_name)
@@ -392,4 +386,9 @@ class Cfg(Bcfg2.Server.Plugin.Plugin):
newname = basefile.name + ".H_%s" % (meta.hostname)
print "This file will be installed as file %s" % newname
if raw_input("Should it be installed? (N/y): ") in 'Yy':
- update_file(newname, diff)
+ print "writing file, %s" % newname
+ if fulldata:
+ newdata = fulldata
+ else:
+ newdata = '\n'.join(difflib.restore(diff.split('\n'), 1))
+ open(newname, 'w').write(newdata)