summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Plugins/PkgVars.py
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2013-03-10 23:07:22 +0100
committerAlexander Sulfrian <asulfrian@zedat.fu-berlin.de>2022-01-23 19:57:46 +0100
commitef568d29698c00bf2c02c99a34b98e6b8ca96653 (patch)
tree2d80f6b4f40e0e1ccb0b4b5c0d5a1668bd1f2b66 /src/lib/Bcfg2/Server/Plugins/PkgVars.py
parent4e1a98aec6afa273bda82e3f840d3ed27e42b3be (diff)
downloadbcfg2-ef568d29698c00bf2c02c99a34b98e6b8ca96653.tar.gz
bcfg2-ef568d29698c00bf2c02c99a34b98e6b8ca96653.tar.bz2
bcfg2-ef568d29698c00bf2c02c99a34b98e6b8ca96653.zip
PkgVars: Add support for multiple values
If multiple values specified for one package all values are joined together in a set.
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugins/PkgVars.py')
-rw-r--r--src/lib/Bcfg2/Server/Plugins/PkgVars.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/PkgVars.py b/src/lib/Bcfg2/Server/Plugins/PkgVars.py
index a085ea17e..9a2649d02 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