summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--schemas/packages.xsd17
-rw-r--r--src/lib/Server/Plugins/Packages.py24
2 files changed, 27 insertions, 14 deletions
diff --git a/schemas/packages.xsd b/schemas/packages.xsd
index 342920c2b..e15fb7f99 100644
--- a/schemas/packages.xsd
+++ b/schemas/packages.xsd
@@ -32,12 +32,13 @@
</xsd:sequence>
</xsd:complexType>
- <xsd:element name='Sources'>
- <xsd:complexType>
- <xsd:choice minOccurs='1' maxOccurs='unbounded'>
- <xsd:element name='APTSource' type='SourceType'/>
- <xsd:element name='YUMSource' type='SourceType'/>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
+ <xsd:complexType name='SourcesType'>
+ <xsd:choice minOccurs='1' maxOccurs='unbounded'>
+ <xsd:element name='APTSource' type='SourceType'/>
+ <xsd:element name='YUMSource' type='SourceType'/>
+ <xsd:element name='Sources' type='SourcesType'/>
+ </xsd:choice>
+ </xsd:complexType>
+
+ <xsd:element name='Sources' type='SourcesType'/>
</xsd:schema>
diff --git a/src/lib/Server/Plugins/Packages.py b/src/lib/Server/Plugins/Packages.py
index 40b01e64e..7978ddd62 100644
--- a/src/lib/Server/Plugins/Packages.py
+++ b/src/lib/Server/Plugins/Packages.py
@@ -543,16 +543,22 @@ class Packages(Bcfg2.Server.Plugin.Plugin,
# create cache directory if needed
os.makedirs(self.cachepath)
try:
- xdata = lxml.etree.parse(self.data + '/config.xml').getroot()
+ xdata = lxml.etree.parse(self.data + '/config.xml')
+ xdata.xinclude()
+ xdata = xdata.getroot()
+ except (lxml.etree.XIncludeError, \
+ lxml.etree.XMLSyntaxError), xmlerr:
+ self.logger.error("Package: Error processing xml: %s" % xmlerr)
+ raise Bcfg2.Server.Plugin.PluginInitError
except IOError:
self.logger.error("Failed to read Packages configuration. Have"
" you created your config.xml file?")
raise Bcfg2.Server.Plugin.PluginInitError
self.sentinels = set()
self.sources = []
- for s in xdata.findall('APTSource'):
+ for s in xdata.findall('.//APTSource'):
self.sources.append(APTSource(self.cachepath, **source_from_xml(s)))
- for s in xdata.findall('YUMSource'):
+ for s in xdata.findall('.//YUMSource'):
self.sources.append(YUMSource(self.cachepath, **source_from_xml(s)))
for source in self.sources:
source.setup_data()
@@ -682,16 +688,22 @@ class Packages(Bcfg2.Server.Plugin.Plugin,
def Refresh(self):
'''Packages.Refresh() => True|False\nReload configuration specification and sources\n'''
try:
- xdata = lxml.etree.parse(self.data + '/config.xml').getroot()
+ xdata = lxml.etree.parse(self.data + '/config.xml')
+ xdata.xinclude()
+ xdata = xdata.getroot()
+ except (lxml.etree.XIncludeError, \
+ lxml.etree.XMLSyntaxError), xmlerr:
+ self.logger.error("Package: Error processing xml: %s" % xmlerr)
+ raise Bcfg2.Server.Plugin.PluginInitError
except IOError:
self.logger.error("Failed to read Packages configuration. Have" +
" you created your config.xml file?")
raise Bcfg2.Server.Plugin.PluginInitError
self.sentinels = set()
self.sources = []
- for s in xdata.findall('APTSource'):
+ for s in xdata.findall('.//APTSource'):
self.sources.append(APTSource(self.cachepath, **source_from_xml(s)))
- for s in xdata.findall('YUMSource'):
+ for s in xdata.findall('.//YUMSource'):
self.sources.append(YUMSource(self.cachepath, **source_from_xml(s)))
for source in self.sources:
source.setup_data()