summaryrefslogtreecommitdiffstats
path: root/tools/bcfg2-profile-templates.py
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-10-30 10:22:02 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2013-01-17 10:41:27 -0500
commit0fc1f472a0fb18911bde1cb99f03142681804476 (patch)
treec957495030e716a8d950dba803b15dc01428babc /tools/bcfg2-profile-templates.py
parent78dfedb4b450005246508cea08874637fcc86885 (diff)
downloadbcfg2-0fc1f472a0fb18911bde1cb99f03142681804476.tar.gz
bcfg2-0fc1f472a0fb18911bde1cb99f03142681804476.tar.bz2
bcfg2-0fc1f472a0fb18911bde1cb99f03142681804476.zip
removed deprecated plugins: TGenshi, TCheetah, Account, Hostbase, Snapshots, Statistics, Editor
Diffstat (limited to 'tools/bcfg2-profile-templates.py')
-rwxr-xr-xtools/bcfg2-profile-templates.py62
1 files changed, 30 insertions, 32 deletions
diff --git a/tools/bcfg2-profile-templates.py b/tools/bcfg2-profile-templates.py
index fe7146d27..54f8e87f3 100755
--- a/tools/bcfg2-profile-templates.py
+++ b/tools/bcfg2-profile-templates.py
@@ -73,40 +73,38 @@ def main():
clients = [core.build_metadata(setup['client'])]
times = dict()
- for plugin in ['Cfg', 'TGenshi', 'TCheetah']:
- if plugin not in core.plugins:
- logger.debug("Skipping disabled plugin %s" % plugin)
- continue
- logger.info("Rendering templates from plugin %s" % plugin)
+ if 'Cfg' not in core.plugins:
+ logger.error("Cfg is not enabled")
+ return 1
- entrysets = []
- for template in templates:
- try:
- entrysets.append(core.plugins[plugin].entries[template])
- except KeyError:
- logger.debug("Template %s not found in plugin %s" %
- (template, plugin))
- if not entrysets:
- logger.debug("Using all entrysets in plugin %s" % plugin)
- entrysets = core.plugins[plugin].entries.values()
+ cfg = core.plugins['Cfg']
+ entrysets = []
+ for template in templates:
+ try:
+ entrysets.append(cfg.entries[template])
+ except KeyError:
+ logger.debug("Template %s not found" % template)
+ if not entrysets:
+ logger.debug("Using all entrysets")
+ entrysets = cfg.entries.values()
- for eset in entrysets:
- path = eset.path.replace(setup['repo'], '')
- logger.info("Rendering %s..." % path)
- times[path] = dict()
- for metadata in clients:
- avg = 0.0
- for i in range(runs):
- entry = lxml.etree.Element("Path")
- start = time.time()
- try:
- eset.bind_entry(entry, metadata)
- avg += (time.time() - start) / runs
- except:
- break
- if avg:
- logger.debug(" %s: %.02f sec" % (metadata.hostname, avg))
- times[path][metadata.hostname] = avg
+ for eset in entrysets:
+ path = eset.path.replace(setup['repo'], '')
+ logger.info("Rendering %s..." % path)
+ times[path] = dict()
+ for metadata in clients:
+ avg = 0.0
+ for i in range(runs):
+ entry = lxml.etree.Element("Path")
+ start = time.time()
+ try:
+ eset.bind_entry(entry, metadata)
+ avg += (time.time() - start) / runs
+ except:
+ break
+ if avg:
+ logger.debug(" %s: %.02f sec" % (metadata.hostname, avg))
+ times[path][metadata.hostname] = avg
# print out per-template results
tmpltimes = []