summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Brattain <ross.b.brattain@intel.com>2017-06-21 09:24:38 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-06-21 09:24:38 +0000
commit8b8738ed675f8aab93d484df300e3d0c6c24becc (patch)
tree26cb42480005cd0811d4a2c216b022944fa20c10
parent5c8e38667e17059db1c62dd21f868966a6b2a519 (diff)
parent2350849a5c764822f267ca5c9efc4a847c9132e6 (diff)
Merge "heat: use dict literal in init_template"
-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__()