diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2011-08-01 09:48:35 -0400 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2011-08-01 09:48:35 -0400 |
commit | 066aad5e10c05133b8650a50f18f44c9de276030 (patch) | |
tree | 21a0623660ac97ad49f5efe27602dd2a5c2a2fbf /src/lib/Server/Lint/RequiredAttrs.py | |
parent | 6fdffa2059e19567fe46d8f48eda6bb3f461caea (diff) | |
download | bcfg2-066aad5e10c05133b8650a50f18f44c9de276030.tar.gz bcfg2-066aad5e10c05133b8650a50f18f44c9de276030.tar.bz2 bcfg2-066aad5e10c05133b8650a50f18f44c9de276030.zip |
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 <Client> 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.
Diffstat (limited to 'src/lib/Server/Lint/RequiredAttrs.py')
-rw-r--r-- | src/lib/Server/Lint/RequiredAttrs.py | 29 |
1 files changed, 29 insertions, 0 deletions
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 """ |