diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2015-02-07 18:54:28 +0100 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2015-02-07 19:49:48 +0100 |
commit | cc4af9966238a6d958b3248e45f3c302d8ba9026 (patch) | |
tree | 8c99f11c5dc3b71c8db9b1d2ba7ad7eb122571fb | |
parent | ea9bab9500eda7dcc247c19a8aa108dc9e7d709e (diff) | |
download | bcfg2-cc4af9966238a6d958b3248e45f3c302d8ba9026.tar.gz bcfg2-cc4af9966238a6d958b3248e45f3c302d8ba9026.tar.bz2 bcfg2-cc4af9966238a6d958b3248e45f3c302d8ba9026.zip |
Add Dummy packages backend and client tool to ignore all packages.v1.4.0pre1-spline13
-rw-r--r-- | schemas/packages.xsd | 1 | ||||
-rw-r--r-- | schemas/types.xsd | 1 | ||||
-rw-r--r-- | src/lib/Bcfg2/Client/Tools/Dummy.py | 16 | ||||
-rw-r--r-- | src/lib/Bcfg2/Server/Plugins/Packages/Dummy.py | 35 | ||||
-rw-r--r-- | src/lib/Bcfg2/Server/Plugins/Packages/__init__.py | 3 |
5 files changed, 55 insertions, 1 deletions
diff --git a/schemas/packages.xsd b/schemas/packages.xsd index 08c51a1d1..b61b97dde 100644 --- a/schemas/packages.xsd +++ b/schemas/packages.xsd @@ -20,6 +20,7 @@ <xsd:enumeration value="pkgng"/> <xsd:enumeration value="portage"/> <xsd:enumeration value="layman"/> + <xsd:enumeration value="dummy"/> </xsd:restriction> </xsd:simpleType> diff --git a/schemas/types.xsd b/schemas/types.xsd index 0a55f6355..5165d186b 100644 --- a/schemas/types.xsd +++ b/schemas/types.xsd @@ -28,6 +28,7 @@ <xsd:enumeration value='ebuild' /> <xsd:enumeration value='yum' /> <xsd:enumeration value='freebsdpkg' /> + <xsd:enumeration value='dummy' /> </xsd:restriction> </xsd:simpleType> diff --git a/src/lib/Bcfg2/Client/Tools/Dummy.py b/src/lib/Bcfg2/Client/Tools/Dummy.py new file mode 100644 index 000000000..9a96eb904 --- /dev/null +++ b/src/lib/Bcfg2/Client/Tools/Dummy.py @@ -0,0 +1,16 @@ +"""This is the Bcfg2 tool for the Dummy package system.""" + +import re +import Bcfg2.Client.Tools + + +class Dummy(Bcfg2.Client.Tools.PkgTool): + __handles__ = [('Package', 'dummy')] + __req__ = {'Package': []} + pkgtype = 'dummy' + + def RefreshPackages(self): + pass + + def VerifyPackage(self, _entry, _): + return True diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Dummy.py b/src/lib/Bcfg2/Server/Plugins/Packages/Dummy.py new file mode 100644 index 000000000..f47b8f22c --- /dev/null +++ b/src/lib/Bcfg2/Server/Plugins/Packages/Dummy.py @@ -0,0 +1,35 @@ +""" Dummy backend for :mod:`Bcfg2.Server.Plugins.Packages` """ + +from Bcfg2.Server.Plugins.Packages.Collection import Collection +from Bcfg2.Server.Plugins.Packages.Source import Source + + +class DummyCollection(Collection): + """ Handle collections of Dummy sources. This is a no-op object + that simply inherits from + :class:`Bcfg2.Server.Plugins.Packages.Collection.Collection`, + overrides nothing, and defers all operations to :class:`PacSource` + """ + + def __init__(self, metadata, sources, cachepath, basepath, debug=False): + # we define an __init__ that just calls the parent __init__, + # so that we can set the docstring on __init__ to something + # different from the parent __init__ -- namely, the parent + # __init__ docstring, minus everything after ``.. -----``, + # which we use to delineate the actual docs from the + # .. autoattribute hacks we have to do to get private + # attributes included in sphinx 1.0 """ + Collection.__init__(self, metadata, sources, cachepath, basepath, + debug=debug) + __init__.__doc__ = Collection.__init__.__doc__.split(".. -----")[0] + + +class DummySource(Source): + """ Handle Dummy sources """ + + #: DummySource sets the ``type`` on Package entries to "dummy" + ptype = 'dummy' + + def __init__(self, basepath, xsource): + xsource.set('rawurl', 'http://example.com/') + Source.__init__(self, basepath, xsource) diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py b/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py index 8ddc050f7..a03c9d721 100644 --- a/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py +++ b/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py @@ -103,7 +103,8 @@ class Packages(Bcfg2.Server.Plugin.Plugin, help="Packages backends to load", type=Bcfg2.Options.Types.comma_list, action=PackagesBackendAction, - default=['Yum', 'Apt', 'Pac', 'Pkgng', 'Portage', 'Layman']), + default=['Yum', 'Apt', 'Pac', 'Pkgng', 'Portage', 'Layman', + 'Dummy']), Bcfg2.Options.PathOption( cf=("packages", "cache"), dest="packages_cache", help="Path to the Packages cache", |