summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmma Foley <emma.l.foley@intel.com>2018-02-12 14:06:58 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-02-12 14:06:58 +0000
commitbabe3cc2882e19c6dafdbf41d502d7ba5560635a (patch)
treefa846776988346090795963a6f8046e933bd5794
parent7dde4c902675ff27143701d067510c58f3bd6207 (diff)
parent326ca99184b896d75266737466516846df29b447 (diff)
Merge "Heatstack create: fix str/bytes error in NamedTemporaryFile.write()"
-rw-r--r--yardstick/orchestrator/heat.py2
-rw-r--r--yardstick/tests/unit/orchestrator/test_heat.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/yardstick/orchestrator/heat.py b/yardstick/orchestrator/heat.py
index 1a8beaeb6..754482e4f 100644
--- a/yardstick/orchestrator/heat.py
+++ b/yardstick/orchestrator/heat.py
@@ -53,7 +53,7 @@ class HeatStack(object):
def create(self, template, heat_parameters, wait, timeout):
"""Creates an OpenStack stack from a template"""
with tempfile.NamedTemporaryFile('wb', delete=False) as template_file:
- template_file.write(jsonutils.dumps(template))
+ template_file.write(jsonutils.dump_as_bytes(template))
template_file.close()
self._stack = self._cloud.create_stack(
self.name, template_file=template_file.name, wait=wait,
diff --git a/yardstick/tests/unit/orchestrator/test_heat.py b/yardstick/tests/unit/orchestrator/test_heat.py
index 9164197b8..f53c9b78c 100644
--- a/yardstick/tests/unit/orchestrator/test_heat.py
+++ b/yardstick/tests/unit/orchestrator/test_heat.py
@@ -59,7 +59,7 @@ class HeatStackTestCase(unittest.TestCase):
with mock.patch.object(tempfile._TemporaryFileWrapper, '__enter__',
return_value=mock_tfile):
self.heatstack.create(template, heat_parameters, True, 100)
- mock_tfile.write.assert_called_once_with(jsonutils.dumps(template))
+ mock_tfile.write.assert_called_once_with(jsonutils.dump_as_bytes(template))
mock_tfile.close.assert_called_once()
self.mock_stack_create.assert_called_once_with(