From c715a661fece0e2e561d4d62a27e9bdac212c54a Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Fri, 28 Jun 2013 23:48:45 +0200 Subject: 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. --- src/lib/Bcfg2/Client/Frame.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') 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 -- cgit v1.2.3-1-g7c22