summaryrefslogtreecommitdiffstats
path: root/src/lib/Server
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/Server')
-rw-r--r--src/lib/Server/Plugins/Base.py10
-rw-r--r--src/lib/Server/Plugins/Bundler.py10
2 files changed, 12 insertions, 8 deletions
diff --git a/src/lib/Server/Plugins/Base.py b/src/lib/Server/Plugins/Base.py
index 71719263f..1cdd7599c 100644
--- a/src/lib/Server/Plugins/Base.py
+++ b/src/lib/Server/Plugins/Base.py
@@ -2,7 +2,7 @@
__revision__ = '$Revision$'
from copy import deepcopy
-from lxml.etree import Element, XML, XMLSyntaxError
+from lxml.etree import Element, XML, XMLSyntaxError, _Comment
from Bcfg2.Server.Plugin import Plugin, PluginInitError, SingleXMLFileBacked
@@ -30,13 +30,15 @@ class Base(Plugin, SingleXMLFileBacked):
self.LogError("Failed to parse base.xml")
return
self.store = {'all':[], 'Class':{'all':[]}, 'Image':{'all':[]}, 'all':[]}
- for entry in xdata.getchildren():
+ for entry in [ent for ent in xdata.getchildren() if not isinstance(ent, _Comment)]:
if entry.tag in ['Image', 'Class']:
if not self.store[entry.tag].has_key(entry.get('name')):
self.store[entry.tag][entry.get('name')] = {'all':[], 'Class':{}, 'Image':{}}
- for child in entry.getchildren():
+ for child in [ent for ent in entry.getchildren() if not isinstance(ent, _Comment)]:
if child.tag in ['Image', 'Class']:
- self.store[entry.tag][entry.get('name')][child.tag][child.get('name')] = child.getchildren()
+ self.store[entry.tag][entry.get('name')][child.tag][child.get('name')] = \
+ [ent for ent in child.getchildren() if \
+ not isinstance(ent, _Comment)]
else:
self.store[entry.tag][entry.get('name')]['all'].append(child)
else:
diff --git a/src/lib/Server/Plugins/Bundler.py b/src/lib/Server/Plugins/Bundler.py
index 86c52b9e2..4b357f121 100644
--- a/src/lib/Server/Plugins/Bundler.py
+++ b/src/lib/Server/Plugins/Bundler.py
@@ -3,7 +3,7 @@ __revision__ = '$Revision$'
from copy import deepcopy
from syslog import LOG_ERR, syslog
-from lxml.etree import Element, XML, XMLSyntaxError
+from lxml.etree import Element, XML, XMLSyntaxError, _Comment
from Bcfg2.Server.Plugin import Plugin, SingleXMLFileBacked, XMLFileBacked, DirectoryBacked
@@ -50,11 +50,13 @@ class Bundle(XMLFileBacked):
self.all = []
self.systems = {}
self.attributes = {}
- for entry in xdata.getchildren():
+ for entry in [ent for ent in xdata.getchildren() if not isinstance(ent, _Comment)]:
if entry.tag == 'System':
- self.systems[entry.attrib['name']] = entry.getchildren()
+ self.systems[entry.attrib['name']] = [ent for ent in entry.getchildren() \
+ if not isinstance(ent, _Comment)]
elif entry.tag == 'Attribute':
- self.attributes[entry.get('name')] = entry.getchildren()
+ self.attributes[entry.get('name')] = [ent for ent in entry.getchildren() \
+ if not isinstance(ent, _Comment)]
else:
self.all.append(entry)
del self.data