From 066aad5e10c05133b8650a50f18f44c9de276030 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Mon, 1 Aug 2011 09:48:35 -0400 Subject: Lots of improvements to Packages plugin: * Better config handling: Split into packages.conf (which contains one-time configuration directives) and sources.xml (which contains the actual package sources.) The config file looks like a StructFile, and supports tags and negated Client and Group tags. Packages.Reload (_not_ Refresh) is run on changes to the sources config. tools/packages-convert.py is provided to convert to the new format. * Automagic handling of GPG keys. The new config format handles association of GPG keys go with repos; Packages then Does The Right Thing and gets them to the clients, gets them installed properly, and handles them in the specification. At the moment this only works for yum repos, not APT (see below). * Automatic generation of yum configs using the sources and GPG keys supplied. APT configs are not done yet (see below). * The early vestiges of integration with Pulp (pulpproject.org). Yet to do: * Better support for Pulp; documentation on Pulp integration. * APT support for key handling and config generation. --- src/lib/Server/Lint/RequiredAttrs.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/lib/Server/Lint/RequiredAttrs.py') diff --git a/src/lib/Server/Lint/RequiredAttrs.py b/src/lib/Server/Lint/RequiredAttrs.py index adfffcbe0..e181650c1 100644 --- a/src/lib/Server/Lint/RequiredAttrs.py +++ b/src/lib/Server/Lint/RequiredAttrs.py @@ -1,6 +1,7 @@ import os.path import lxml.etree import Bcfg2.Server.Lint +import Bcfg2.Server.Plugins.Packages class RequiredAttrs(Bcfg2.Server.Lint.ServerPlugin): """ verify attributes for configuration entries (as defined in @@ -22,6 +23,34 @@ class RequiredAttrs(Bcfg2.Server.Lint.ServerPlugin): def Run(self): self.check_rules() self.check_bundles() + self.check_packages() + + def check_packages(self): + """ check package sources for Source entries with missing attrs """ + if 'Packages' in self.core.plugins: + for source in self.core.plugins['Packages'].sources: + if isinstance(source, Bcfg2.Server.Plugin.Packages.PulpSource): + if not source.id: + self.LintError("required-attrs-missing", + "The required attribute id is missing " + "from a Pulp source: %s" % + self.RenderXML(source.xsource)) + else: + if not source.url and not source.rawurl: + self.LintError("required-attrs-missing", + "A %s source must have either a url or " + "rawurl attribute: %s" % + (source.ptype, + self.RenderXML(source.xsource))) + + if (not isinstance(source, + Bcfg2.Server.Plugin.Packages.APTSource) and + source.recommended): + self.LintError("extra-attrs", + "The recommended attribute is not " + "supported on %s sources: %s" % + (source.ptype, + self.RenderXML(source.xsource))) def check_rules(self): """ check Rules for Path entries with missing attrs """ -- cgit v1.2.3-1-g7c22