aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick
diff options
context:
space:
mode:
authorRoss Brattain <ross.b.brattain@intel.com>2017-02-13 11:31:49 -0800
committerRoss Brattain <ross.b.brattain@intel.com>2017-06-19 23:56:56 +0000
commit2350849a5c764822f267ca5c9efc4a847c9132e6 (patch)
tree01c199840747f3fc2e7d1d7e452fbff8ffcbd5c1 /yardstick
parentc591e10088dd42261f0ee6bc73ad657d0a797ef1 (diff)
heat: use dict literal in init_template
prefer dict literals when possible over increment assignment. Change-Id: Ia40bbc04eed61feb036a1e9ec3b3110b03c095e1 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
Diffstat (limited to 'yardstick')
-rw-r--r--yardstick/orchestrator/heat.py29
1 files changed, 18 insertions, 11 deletions
diff --git a/yardstick/orchestrator/heat.py b/yardstick/orchestrator/heat.py
index ea9bd1b08..864f1f9ec 100644
--- a/yardstick/orchestrator/heat.py
+++ b/yardstick/orchestrator/heat.py
@@ -149,21 +149,28 @@ class HeatStack(HeatObject):
class HeatTemplate(HeatObject):
"""Describes a Heat template and a method to deploy template to a stack"""
- def _init_template(self):
- self._template = {}
- self._template['heat_template_version'] = '2013-05-23'
+ DESCRIPTION_TEMPLATE = """\
+Stack built by the yardstick framework for %s on host %s %s.
+All referred generated resources are prefixed with the template
+name (i.e. %s).\
+"""
+ def _init_template(self):
timestamp = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
- self._template['description'] = \
- """Stack built by the yardstick framework for %s on host %s %s.
- All referred generated resources are prefixed with the template
- name (i.e. %s).""" % (getpass.getuser(), socket.gethostname(),
- timestamp, self.name)
+ self._template = {
+ 'heat_template_version': '2013-05-23',
+ 'description': self.DESCRIPTION_TEMPLATE % (
+ getpass.getuser(),
+ socket.gethostname(),
+ timestamp,
+ self.name
+ ),
+ 'resources': {},
+ 'outputs': {}
+ }
# short hand for resources part of template
- self.resources = self._template['resources'] = {}
-
- self._template['outputs'] = {}
+ self.resources = self._template['resources']
def __init__(self, name, template_file=None, heat_parameters=None):
super(HeatTemplate, self).__init__()