Deal with bytestring serialized json

It looks like we're receiving an serialized json instead of a dict
from heat client when the template has a load from file

Change-Id: Ifa1c63b5feddff01f43a4689e6f12ade7e62d3c1
David Hill 2022-02-09 10:52:30 -05:00 committed by apetrich
parent 458e9b0519
commit 64aeebd1ac
1 changed files with 7 additions and 1 deletions

View File

@ -178,7 +178,13 @@ class CreateStackView(forms.ModalFormView):
if 'environment_data' in self.kwargs:
initial['environment_data'] = self.kwargs['environment_data']
if 'parameters' in self.kwargs:
initial['parameters'] = json.dumps(self.kwargs['parameters'])
parameters = self.kwargs['parameters']
# if instead of a dict we got a bytestring of
# serialized json we don't double dumps it
if isinstance(parameters, bytes):
initial['parameters'] = parameters
initial['parameters'] = json.dumps(parameters)
return initial
def get_form_kwargs(self):