summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Plugins/Metadata.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/Server/Plugins/Metadata.py')
-rw-r--r--src/lib/Server/Plugins/Metadata.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/lib/Server/Plugins/Metadata.py b/src/lib/Server/Plugins/Metadata.py
index cc1f78456..4f0ca9686 100644
--- a/src/lib/Server/Plugins/Metadata.py
+++ b/src/lib/Server/Plugins/Metadata.py
@@ -8,11 +8,10 @@ import copy
import fcntl
import lxml.etree
import os
-import os.path
import socket
import sys
import time
-
+import Bcfg2.Server
import Bcfg2.Server.FileMonitor
import Bcfg2.Server.Plugin
@@ -74,7 +73,8 @@ class XMLMetadataConfig(object):
def load_xml(self):
"""Load changes from XML"""
try:
- xdata = lxml.etree.parse("%s/%s" % (self.basedir, self.basefile))
+ xdata = lxml.etree.parse(os.path.join(self.basedir, self.basefile),
+ parser=Bcfg2.Server.XMLParser)
except lxml.etree.XMLSyntaxError:
self.logger.error('Failed to parse %s' % (self.basefile))
return
@@ -146,10 +146,13 @@ class XMLMetadataConfig(object):
"""Try to find the data in included files"""
for included in self.extras:
try:
- xdata = lxml.etree.parse("%s/%s" % (self.basedir, included))
+ xdata = lxml.etree.parse(os.path.join(self.basedir,
+ included),
+ parser=Bcfg2.Server.XMLParser)
cli = xdata.xpath(xpath)
if len(cli) > 0:
- return {'filename': "%s/%s" % (self.basedir, included),
+ return {'filename': os.path.join(self.basedir,
+ included),
'xmltree': xdata,
'xquery': cli}
except lxml.etree.XMLSyntaxError:
@@ -283,7 +286,8 @@ class Metadata(Bcfg2.Server.Plugin.Plugin,
def get_groups(self):
'''return groups xml tree'''
- groups_tree = lxml.etree.parse(self.data + "/groups.xml")
+ groups_tree = lxml.etree.parse(self.data + "/groups.xml",
+ parser=Bcfg2.Server.XMLParser)
root = groups_tree.getroot()
return root
@@ -341,7 +345,8 @@ class Metadata(Bcfg2.Server.Plugin.Plugin,
def add_bundle(self, bundle_name):
"""Add bundle to groups.xml."""
- tree = lxml.etree.parse(self.data + "/groups.xml")
+ tree = lxml.etree.parse(self.data + "/groups.xml",
+ parser=Bcfg2.Server.XMLParser)
root = tree.getroot()
element = lxml.etree.Element("Bundle", name=bundle_name)
node = self.search_group(bundle_name, tree)
@@ -364,7 +369,8 @@ class Metadata(Bcfg2.Server.Plugin.Plugin,
def remove_bundle(self, bundle_name):
"""Remove a bundle."""
- tree = lxml.etree.parse(self.data + "/groups.xml")
+ tree = lxml.etree.parse(self.data + "/groups.xml",
+ parser=Bcfg2.Server.XMLParser)
root = tree.getroot()
node = self.search_group(bundle_name, tree)
if node == None:
@@ -815,7 +821,8 @@ class Metadata(Bcfg2.Server.Plugin.Plugin,
def include_group(group):
return not only_client or group in clientmeta.groups
- groups_tree = lxml.etree.parse(self.data + "/groups.xml")
+ groups_tree = lxml.etree.parse(self.data + "/groups.xml",
+ parser=Bcfg2.Server.XMLParser)
try:
groups_tree.xinclude()
except lxml.etree.XIncludeError: