diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2013-03-10 22:28:57 +0100 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2013-05-02 10:02:02 +0200 |
commit | 3ed39a70d21fc25d5f9c1419e4c74e5cad557741 (patch) | |
tree | e8942326558d6b256af7897c353b6c3bbff92674 | |
parent | 9d9bcd09c48dc47d8c819ab7840f94a9f8f82451 (diff) | |
download | bcfg2-3ed39a70d21fc25d5f9c1419e4c74e5cad557741.tar.gz bcfg2-3ed39a70d21fc25d5f9c1419e4c74e5cad557741.tar.bz2 bcfg2-3ed39a70d21fc25d5f9c1419e4c74e5cad557741.zip |
Plugins/Packages/Collection: add cclass marker for Sources
The classes of Sources could now specify another class for the
Collection container. One host could only use one Collection class at
a time. So all different Sources have to reference the same
Collection.
If no "cclass" is defined in the Sources class, the collection class
name is generated by striping the "Source" string from the Sources
class name like before.
-rw-r--r-- | debian/changelog | 3 | ||||
-rw-r--r-- | src/lib/Server/Plugins/Packages/Collection.py | 11 |
2 files changed, 9 insertions, 5 deletions
diff --git a/debian/changelog b/debian/changelog index 8791b7b41..b2d60915b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,12 +1,13 @@ bcfg2 (1.2.3-11) UNRELEASED; urgency=low + * Plugins/Packages/Collection: add cclass marker for Sources * Plugins/Packages/Collection: add missing format string parameter * Client/Tools/APT: save new package version for auto pkgs * Plugins/Packages: backported get_new_packages * Plugins/Packages: backported packages_form_entry/_to_entry * Plugins/PkgVars: new plugin to set various vars per package - -- Alexander Sulfrian <alex@spline.inf.fu-berlin.de> Sun, 10 Mar 2013 22:23:12 +0100 + -- Alexander Sulfrian <alex@spline.inf.fu-berlin.de> Sun, 10 Mar 2013 22:28:57 +0100 bcfg2 (1.2.3-9) unstable; urgency=low diff --git a/src/lib/Server/Plugins/Packages/Collection.py b/src/lib/Server/Plugins/Packages/Collection.py index f417a6c54..2e5ff450b 100644 --- a/src/lib/Server/Plugins/Packages/Collection.py +++ b/src/lib/Server/Plugins/Packages/Collection.py @@ -374,12 +374,15 @@ def factory(metadata, sources, basepath, debug=False): for source in sources: if source.applies(metadata): relevant.append(source) - sclasses.update([source.__class__]) + if 'cclass' in dir(source): + sclasses.update([source.cclass]) + else: + sclass = source.__class__.__name__.replace("Source", "") + sclasses.update([sclass]) if len(sclasses) > 1: logger.warning("Packages: Multiple source types found for %s: %s" % - (metadata.hostname, - ", ".join([s.__name__ for s in sclasses]))) + (metadata.hostname, ", ".join(sclasses))) cclass = Collection elif len(sclasses) == 0: # you'd think this should be a warning, but it happens all the @@ -393,7 +396,7 @@ def factory(metadata, sources, basepath, debug=False): metadata.hostname) cclass = Collection else: - stype = sclasses.pop().__name__.replace("Source", "") + stype = sclasses.pop() try: module = \ getattr(__import__("Bcfg2.Server.Plugins.Packages.%s" % |