summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2013-06-28 23:48:45 +0200
committerAlexander Sulfrian <alexander@sulfrian.net>2013-06-29 00:02:03 +0200
commitc715a661fece0e2e561d4d62a27e9bdac212c54a (patch)
tree114bbc78ab67fa45124486784f1b09b8a19ea6b0
parentaed992e317378569abfdc75e0da195e56445db19 (diff)
downloadbcfg2-c715a661fece0e2e561d4d62a27e9bdac212c54a.tar.gz
bcfg2-c715a661fece0e2e561d4d62a27e9bdac212c54a.tar.bz2
bcfg2-c715a661fece0e2e561d4d62a27e9bdac212c54a.zip
Client/Frame: avoid use of lxml-only getparent()
getparent is not supported by xml.etree so try to emulate it with a generated parent_map. This is the only possibility, because xml.etree does not store references to the parent elements.
-rw-r--r--src/lib/Bcfg2/Client/Frame.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/Bcfg2/Client/Frame.py b/src/lib/Bcfg2/Client/Frame.py
index edbc9f055..3254da9e9 100644
--- a/src/lib/Bcfg2/Client/Frame.py
+++ b/src/lib/Bcfg2/Client/Frame.py
@@ -207,12 +207,15 @@ class Frame(object):
# take care of important entries first
if not self.dryrun:
+ parent_map = dict((c, p)
+ for p in self.config.getiterator()
+ for c in p)
for cfile in self.config.findall(".//Path"):
if (cfile.get('name') not in self.__important__ or
cfile.get('type') != 'file' or
cfile not in self.whitelist):
continue
- parent = cfile.getparent()
+ parent = parent_map[cfile]
if ((parent.tag == "Bundle" and
((self.setup['bundle'] and
parent.get("name") not in self.setup['bundle']) or