summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Plugins/Cfg.py
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2007-10-30 03:14:44 +0000
committerNarayan Desai <desai@mcs.anl.gov>2007-10-30 03:14:44 +0000
commit77cbb937c108869fbde5ab6fb132a8a05cd406a3 (patch)
treec4aef4ff2645fd20af4a3a75f145aafd27508f8e /src/lib/Server/Plugins/Cfg.py
parent23fcbe41f466bd4269a96f1730cbe4ae230a521f (diff)
downloadbcfg2-77cbb937c108869fbde5ab6fb132a8a05cd406a3.tar.gz
bcfg2-77cbb937c108869fbde5ab6fb132a8a05cd406a3.tar.bz2
bcfg2-77cbb937c108869fbde5ab6fb132a8a05cd406a3.zip
Implement bcfg2-admin pull support for info files/metadata changes (Resolves Ticket #480)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@3886 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, 13 insertions, 2 deletions
diff --git a/src/lib/Server/Plugins/Cfg.py b/src/lib/Server/Plugins/Cfg.py
index 987cc2da8..f653f53f3 100644
--- a/src/lib/Server/Plugins/Cfg.py
+++ b/src/lib/Server/Plugins/Cfg.py
@@ -127,7 +127,6 @@ class ConfigFileEntry(object):
if basename in [':info', 'info']:
return self.read_info(basename)
elif basename in ['info.xml', ':info.xml']:
- print "here"
fpath = self.repopath + '/' + basename
self.infoxml = Bcfg2.Server.Plugin.XMLSrc(fpath, True)
return
@@ -372,8 +371,20 @@ 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, fulldata):
+ def AcceptEntry(self, meta, _, entry_name, diff, fulldata, metadata_updates={}):
'''per-plugin bcfg2-admin pull support'''
+ if metadata_updates:
+ if hasattr(self.Entries['ConfigFile'][entry_name], 'infoxml'):
+ print "InfoXML support not yet implemented"
+ elif raw_input("Should metadata updates apply to all hosts? (n/Y) ") in 'yY':
+ self.entries[entry_name].metadata.update(metadata_updates)
+ infofile = open(self.entries[entry_name].repopath + '/:info', 'w')
+ for x in self.entries[entry_name].metadata.iteritems():
+ infofile.write("%s: %s\n" % x)
+ infofile.close()
+ if not diff or fulldata:
+ raise SystemExit, 0
+
hsq = "Found host-specific file %s; Should it be updated (n/Y): "
repo_vers = lxml.etree.Element('ConfigFile', name=entry_name)
self.Entries['ConfigFile'][entry_name](repo_vers, meta)