Bugfix: heat: don't json encode template 09/29509/5
authorRoss Brattain <ross.b.brattain@intel.com>
Wed, 1 Mar 2017 00:33:50 +0000 (16:33 -0800)
committerRoss Brattain <ross.b.brattain@intel.com>
Fri, 10 Mar 2017 01:39:11 +0000 (01:39 +0000)
heatclient.common.http.SessionClient
automatically json.dumps the data in kwargs.
If we json dump ourselves we end up double-decoding
which is invalid.

heatclient.common.http.py:

class SessionClient(adapter.LegacyJsonAdapter):
    """HTTP client based on Keystone client session."""

    def request(self, url, method, **kwargs):
        redirect = kwargs.get('redirect')
        kwargs.setdefault('user_agent', USER_AGENT)

        if 'data' in kwargs:
            kwargs['data'] = jsonutils.dumps(kwargs['data'])

kwargs['data'] includes the template,
so this is double-decoding in JSON

JIRA: YARDSTICK-584

Change-Id: I663af42f7e92e285b540b614ceda87f17da5f22d
Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
yardstick/orchestrator/heat.py

index 500776e..49126f6 100644 (file)
@@ -21,7 +21,6 @@ import time
 
 import heatclient
 import pkg_resources
-from oslo_serialization import jsonutils
 from oslo_utils import encodeutils
 
 import yardstick.common.openstack_utils as op_utils
@@ -453,11 +452,9 @@ class HeatTemplate(HeatObject):
         stack = HeatStack(self.name)
 
         heat = self._get_heat_client()
-        json_template = jsonutils.dump_as_bytes(
-            self._template)
         start_time = time.time()
         stack.uuid = self.uuid = heat.stacks.create(
-            stack_name=self.name, template=json_template,
+            stack_name=self.name, template=self._template,
             parameters=self.heat_parameters)['stack']['id']
 
         status = self.status()