summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSol Jerome <sol.jerome@gmail.com>2011-02-21 15:43:58 -0600
committerSol Jerome <sol.jerome@gmail.com>2011-02-21 15:43:58 -0600
commitdfbd50f2dedf33b2369fc0d6f3d11a4f06b7c862 (patch)
tree819e4c648297ffbfda8ffa51360c7c646eefae64 /src
parentcebc13ad35a2c63ba7cf1374d60a32beaa01f275 (diff)
downloadbcfg2-dfbd50f2dedf33b2369fc0d6f3d11a4f06b7c862.tar.gz
bcfg2-dfbd50f2dedf33b2369fc0d6f3d11a4f06b7c862.tar.bz2
bcfg2-dfbd50f2dedf33b2369fc0d6f3d11a4f06b7c862.zip
Cfg: Create info.xml files by default with bcfg2-admin pull
Using info.xml files allows the user to validate permissions with the info schema. Signed-off-by: Sol Jerome <sol.jerome@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/lib/Server/Plugins/Cfg.py26
1 files changed, 9 insertions, 17 deletions
diff --git a/src/lib/Server/Plugins/Cfg.py b/src/lib/Server/Plugins/Cfg.py
index e22102ffa..f851b7914 100644
--- a/src/lib/Server/Plugins/Cfg.py
+++ b/src/lib/Server/Plugins/Cfg.py
@@ -174,23 +174,15 @@ class CfgEntrySet(Bcfg2.Server.Plugin.EntrySet):
metadata_updates.update(self.metadata)
for attr in badattr:
metadata_updates[attr] = new_entry.get(attr)
- if self.infoxml:
- infoxml = lxml.etree.Element('FileInfo')
- infotag = lxml.etree.SubElement(infoxml, 'Info')
- [infotag.attrib.__setitem__(attr, metadata_updates[attr]) \
- for attr in metadata_updates]
- ofile = open(self.path + "/info.xml","w")
- ofile.write(lxml.etree.tostring(infoxml, pretty_print=True))
- ofile.close()
- if log:
- logger.info("Wrote file %s" % (self.path + "/info.xml"))
- else:
- infofile = open(self.path + '/:info', 'w')
- for x in metadata_updates.iteritems():
- infofile.write("%s: %s\n" % x)
- infofile.close()
- if log:
- logger.info("Wrote file %s" % infofile.name)
+ infoxml = lxml.etree.Element('FileInfo')
+ infotag = lxml.etree.SubElement(infoxml, 'Info')
+ [infotag.attrib.__setitem__(attr, metadata_updates[attr]) \
+ for attr in metadata_updates]
+ ofile = open(self.path + "/info.xml","w")
+ ofile.write(lxml.etree.tostring(infoxml, pretty_print=True))
+ ofile.close()
+ if log:
+ logger.info("Wrote file %s" % (self.path + "/info.xml"))
class Cfg(Bcfg2.Server.Plugin.GroupSpool,
Bcfg2.Server.Plugin.PullTarget):