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:03:43 +0100 |
commit | 611ea3fc503e7d210cc180722271cc8bca15c559 (patch) | |
tree | 1d931029e2afa40014b38ce410e57a931e0c3f36 /src/lib/Bcfg2/Server/Plugins/Packages/Dummy.py | |
parent | 7a2c7e45ae0cad254a26bed767303b2113f7be6e (diff) | |
download | bcfg2-packages-dummy.tar.gz bcfg2-packages-dummy.tar.bz2 bcfg2-packages-dummy.zip |
Add Dummy packages backend and client tool to ignore all packages.packages-dummy
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugins/Packages/Dummy.py')
-rw-r--r-- | src/lib/Bcfg2/Server/Plugins/Packages/Dummy.py | 35 |
1 files changed, 35 insertions, 0 deletions
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) |