summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Packages/Source.py23
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Packages/Yum.py27
2 files changed, 32 insertions, 18 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Source.py b/src/lib/Bcfg2/Server/Plugins/Packages/Source.py
index 7188394b3..0e27f99f1 100644
--- a/src/lib/Bcfg2/Server/Plugins/Packages/Source.py
+++ b/src/lib/Bcfg2/Server/Plugins/Packages/Source.py
@@ -111,14 +111,6 @@ class Source(Bcfg2.Server.Plugin.Debuggable):
#: make sources of this type available to clients.
basegroups = []
- #: A predicate that is used by :func:`filter_unknown` to filter
- #: packages from the results of
- #: :func:`Bcfg2.Server.Plugins.Packages.Collection.Collection.complete`
- #: that should not be shown to the end user (i.e., that are not
- #: truly unknown, but are rather packaging system artifacts). By
- #: default, excludes any package whose name starts with "choice"
- unknown_filter = lambda p: p.startswith("choice")
-
#: The Package type handled by this Source class. The ``type``
#: attribute of Package entries will be set to the value ``ptype``
#: when they are handled by :mod:`Bcfg2.Server.Plugins.Packages`.
@@ -573,6 +565,21 @@ class Source(Bcfg2.Server.Plugin.Debuggable):
self.provides[barch][prov] = prov[barch].get(prov, ())
self.save_state()
+ def unknown_filter(self, package):
+ """ A predicate that is used by :func:`filter_unknown` to
+ filter packages from the results of
+ :func:`Bcfg2.Server.Plugins.Packages.Collection.Collection.complete`
+ that should not be shown to the end user (i.e., that are not
+ truly unknown, but are rather packaging system artifacts). By
+ default, excludes any package whose name starts with "choice"
+
+ :param package: The name of a package that was unknown to the
+ backend
+ :type package: string
+ :returns: bool
+ """
+ return package.startswith("choice")
+
def filter_unknown(self, unknown):
""" After
:func:`Bcfg2.Server.Plugins.Packages.Collection.Collection.complete`,
diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py b/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py
index 474bddc49..9b915048d 100644
--- a/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py
+++ b/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py
@@ -778,16 +778,6 @@ class YumSource(Source):
#: YumSource sets the ``type`` on Package entries to "yum"
ptype = 'yum'
- #: By default,
- #: :class:`Bcfg2.Server.Plugins.Packages.Source.Source` filters
- #: out unknown packages that start with "choice", but that doesn't
- #: mean anything to Yum or RPM. Instead, we filter out unknown
- #: packages that start with "rpmlib", although this is likely
- #: legacy behavior; that would seem to indicate that a package
- #: required some RPM feature that isn't provided, which is a bad
- #: thing. This should probably go away at some point.
- unknown_filter = lambda u: u.startswith("rpmlib")
-
def __init__(self, basepath, xsource, setup):
Source.__init__(self, basepath, xsource, setup)
self.pulp_id = None
@@ -1022,6 +1012,23 @@ class YumSource(Source):
return rv
get_vpkgs.__doc__ = Source.get_vpkgs.__doc__
+ def unknown_filter(self, package):
+ """ By default,
+ :class:`Bcfg2.Server.Plugins.Packages.Source.Source` filters
+ out unknown packages that start with "choice", but that
+ doesn't mean anything to Yum or RPM. Instead, we filter out
+ unknown packages that start with "rpmlib", although this is
+ likely legacy behavior; that would seem to indicate that a
+ package required some RPM feature that isn't provided, which
+ is a bad thing. This should probably go away at some point.
+
+ :param package: The name of a package that was unknown to the
+ backend
+ :type package: string
+ :returns: bool
+ """
+ return package.startswith("rpmlib")
+
def filter_unknown(self, unknown):
if self.use_yum:
filtered = set()