summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-01-25 09:56:48 -0500
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-01-25 09:56:48 -0500
commitfbfd6bb0d6bc5c0b6660233269d8aabb13da49ea (patch)
tree0b371f8e6aaccfd8a9913abc068e81ab37b5e81e /src/lib
parentaddb374b3388c7faa33ff5664293348874dd295d (diff)
downloadbcfg2-fbfd6bb0d6bc5c0b6660233269d8aabb13da49ea.tar.gz
bcfg2-fbfd6bb0d6bc5c0b6660233269d8aabb13da49ea.tar.bz2
bcfg2-fbfd6bb0d6bc5c0b6660233269d8aabb13da49ea.zip
fixed Pkgmgr bcfg2-lint plugin (#1082)
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Server/Lint/Pkgmgr.py20
-rw-r--r--src/lib/Server/Plugin.py3
2 files changed, 12 insertions, 11 deletions
diff --git a/src/lib/Server/Lint/Pkgmgr.py b/src/lib/Server/Lint/Pkgmgr.py
index 3960a8cf9..8f099163a 100644
--- a/src/lib/Server/Lint/Pkgmgr.py
+++ b/src/lib/Server/Lint/Pkgmgr.py
@@ -1,21 +1,19 @@
+import glob
+import lxml.etree
import Bcfg2.Server.Lint
-class Pkgmgr(Bcfg2.Server.Lint.ServerPlugin):
+class Pkgmgr(Bcfg2.Server.Lint.ServerlessPlugin):
""" find duplicate Pkgmgr entries with the same priority """
def Run(self):
- if 'Pkgmgr' not in self.core.plugins:
- self.logger.info("Pkgmgr server plugin is not enabled, skipping Pkgmgr lint checks")
- return
-
pset = set()
- for plist in self.core.plugins['Pkgmgr'].entries.values():
- if self.HandlesFile(plist.name):
- xdata = plist.data
+ for pfile in glob.glob("%s/Pkgmgr/*.xml" % self.config['repo']):
+ if self.HandlesFile(pfile):
+ xdata = lxml.etree.parse(pfile).getroot()
# get priority, type, group
- priority = xdata.getroot().get('priority')
- ptype = xdata.getroot().get('type')
- for pkg in xdata.findall("//Package"):
+ priority = xdata.get('priority')
+ ptype = xdata.get('type')
+ for pkg in xdata.xpath("//Package"):
if pkg.getparent().tag == 'Group':
grp = pkg.getparent().get('name')
if (type(grp) is not str and
diff --git a/src/lib/Server/Plugin.py b/src/lib/Server/Plugin.py
index 1d473fdb7..82b23d21f 100644
--- a/src/lib/Server/Plugin.py
+++ b/src/lib/Server/Plugin.py
@@ -789,6 +789,9 @@ class XMLSrc(XMLFileBacked):
self.pnode.Match(metadata, cache[1])
self.cache = cache
+ def __str__(self):
+ return str(self.items)
+
class InfoXML (XMLSrc):
__node__ = InfoNode