diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2013-03-10 23:07:22 +0100 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2013-07-03 11:58:43 +0200 |
commit | fdc843ba7bfdb53f310b24ac88fa2260493ca808 (patch) | |
tree | 2cb2edf5bbec433513e63d1719fd504848a83b1d | |
parent | b4e3adc9598fbe91c418722ae9cae946604c9843 (diff) | |
download | bcfg2-fdc843ba7bfdb53f310b24ac88fa2260493ca808.tar.gz bcfg2-fdc843ba7bfdb53f310b24ac88fa2260493ca808.tar.bz2 bcfg2-fdc843ba7bfdb53f310b24ac88fa2260493ca808.zip |
Plugins/PkgVars: support multiple values per package
If multiple values specified for one package all values are joined
together in a set.
-rw-r--r-- | src/lib/Bcfg2/Server/Plugins/Packages/Collection.py | 4 | ||||
-rw-r--r-- | src/lib/Bcfg2/Server/Plugins/PkgVars.py | 10 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Collection.py b/src/lib/Bcfg2/Server/Plugins/Packages/Collection.py index 7688ebddd..93b398ac4 100644 --- a/src/lib/Bcfg2/Server/Plugins/Packages/Collection.py +++ b/src/lib/Bcfg2/Server/Plugins/Packages/Collection.py @@ -330,7 +330,7 @@ class Collection(list, Bcfg2.Server.Plugin.Debuggable): pin_source = pinnings[package] for source in self: - if pin_source and pin_source != source.name: + if pin_source and source.name not in pin_source: continue pin_found = True @@ -339,7 +339,7 @@ class Collection(list, Bcfg2.Server.Plugin.Debuggable): if not pin_found: self.logger.error("Packages: Source '%s' for package '%s' not found" % - (pin_source, package)) + (' or '.join(pin_source), package)) return [] diff --git a/src/lib/Bcfg2/Server/Plugins/PkgVars.py b/src/lib/Bcfg2/Server/Plugins/PkgVars.py index 2bf1b158a..40582bcb3 100644 --- a/src/lib/Bcfg2/Server/Plugins/PkgVars.py +++ b/src/lib/Bcfg2/Server/Plugins/PkgVars.py @@ -19,7 +19,12 @@ class PkgVarsFile(Bcfg2.Server.Plugin.StructFile): for v in vars: value = d.get(v, None) if value: - results[v][name] = value + if v not in results: + results[v] = {} + if name not in results[v]: + results[v][name] = set() + + results[v][name].add(value) return results @@ -35,7 +40,8 @@ class PkgVarsDirectoryBacked(Bcfg2.Server.Plugin.DirectoryBacked): for files in self.entries: new = self.entries[files].get_additional_data(meta) for x in vars: - results[x].update(new[x]) + if x in new: + results[x].update(new[x]) return results |