summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Plugins
diff options
context:
space:
mode:
authorCalen Pennington <cpennington@wgen.net>2011-12-09 15:51:57 -0500
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-01-13 11:52:36 -0500
commite81dce803aaa6b904d092452f574099d03bdae99 (patch)
tree4eebb2cf4b4c2cca58b982cdc8fc049ffc411ac2 /src/lib/Server/Plugins
parentfaf3b60bfeb4382f818f5666ee54e82f342eaa71 (diff)
downloadbcfg2-e81dce803aaa6b904d092452f574099d03bdae99.tar.gz
bcfg2-e81dce803aaa6b904d092452f574099d03bdae99.tar.bz2
bcfg2-e81dce803aaa6b904d092452f574099d03bdae99.zip
Don't do duplicate work while matching bundle entries
Diffstat (limited to 'src/lib/Server/Plugins')
-rw-r--r--src/lib/Server/Plugins/Bundler.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/Server/Plugins/Bundler.py b/src/lib/Server/Plugins/Bundler.py
index 04aa3df71..418e47bcb 100644
--- a/src/lib/Server/Plugins/Bundler.py
+++ b/src/lib/Server/Plugins/Bundler.py
@@ -75,9 +75,13 @@ class Bundler(Bcfg2.Server.Plugin.Plugin,
def BuildStructures(self, metadata):
"""Build all structures for client (metadata)."""
bundleset = []
+
+ bundle_entries = {}
+ for key, item in self.entries.items():
+ bundle_entries.setdefault(self.patterns.match(os.path.basename(key)).group('name'), []).append(item)
+
for bundlename in metadata.bundles:
- entries = [item for (key, item) in self.entries.items() if \
- self.patterns.match(os.path.basename(key)).group('name') == bundlename]
+ entries = bundle_entries[bundlename]
if len(entries) == 0:
continue
elif len(entries) == 1: