Bug 1860586

Summary: If a non-json value is used in a json type property, heat only says a non-json value is being used but doesn't indicate which one is wrong
Product: Red Hat OpenStack Reporter: David Hill <dhill>
Component: openstack-heatAssignee: OSP Team <rhos-maint>
Status: CLOSED ERRATA QA Contact: David Rosenfeld <drosenfe>
Severity: low Docs Contact:
Priority: medium    
Version: 16.2 (Train)CC: aschultz, emacchi, kecarter, kmehta, mburns, ramishra, sbaker, shardy
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: x86_64   
OS: All   
Whiteboard:
Fixed In Version: openstack-heat-13.1.1-2.20201103005042.0d7e5bd.el8ost.1 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-09-15 07:08:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description David Hill 2020-07-25 12:17:49 UTC
Description of problem:
If a non-json value is used in a json type property, heat only says a non-json value is being used but doesn't indicate which one is wrong :
$ sh overcloud.sh --debug
Running "openstack overcloud deploy" command
Removing the current plan files
Uploading new plan files
Temporary Swift GET/PUT URL parameters have successfully been updated.
Plan updated.
Processing templates in the directory /tmp/tripleoclient-8jpt8_jh/tripleo-heat-templates
Action tripleo.parameters.update execution failed: Error validating environment for plan viper: ERROR: Internal Error
Traceback (most recent call last):

File "/usr/lib/python3.6/site-packages/heat/engine/parameters.py", line 455, in parse
return jsonutils.loads(val)

File "/usr/lib/python3.6/site-packages/oslo_serialization/jsonutils.py", line 264, in loads
return json.loads(encodeutils.safe_decode(s, encoding), **kwargs)

File "/usr/lib64/python3.6/json/init.py", line 354, in loads
return _default_decoder.decode(s)

File "/usr/lib64/python3.6/json/decoder.py", line 342, in decode
raise JSONDecodeError("Extra data", s, end)

json.decoder.JSONDecodeError: Extra data: line 1 column 7 (char 6)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/usr/lib/python3.6/site-packages/oslo_messaging/rpc/server.py", line 165, in _process_incoming
res = self.dispatcher.dispatch(message)

File "/usr/lib/python3.6/site-packages/oslo_messaging/rpc/dispatcher.py", line 274, in dispatch
return self._do_dispatch(endpoint, method, ctxt, args)

File "/usr/lib/python3.6/site-packages/oslo_messaging/rpc/dispatcher.py", line 194, in _do_dispatch
result = func(ctxt, **new_args)

File "/usr/lib/python3.6/site-packages/osprofiler/profiler.py", line 160, in wrapper
result = f(*args, **kwargs)

File "/usr/lib/python3.6/site-packages/heat/common/context.py", line 423, in wrapped
return func(self, ctx, *args, **kwargs)

File "/usr/lib/python3.6/site-packages/heat/engine/service.py", line 1292, in validate_template
strict_validate=False)

File "/usr/lib/python3.6/site-packages/heat/engine/stack.py", line 220, in init
parent_info)

File "/usr/lib/python3.6/site-packages/heat/engine/stk_defn.py", line 43, in init
template.env.param_defaults)

File "/usr/lib/python3.6/site-packages/heat/engine/hot/template.py", line 222, in parameters
param_defaults=param_defaults)

File "/usr/lib/python3.6/site-packages/heat/engine/parameters.py", line 527, in init
self.params[pd_name].set_default(param_default)

File "/usr/lib/python3.6/site-packages/heat/engine/parameters.py", line 383, in set_default
self._update_parsed()

File "/usr/lib/python3.6/site-packages/heat/engine/parameters.py", line 390, in _update_parsed
self.parsed = self.parse(self.default())

File "/usr/lib/python3.6/site-packages/heat/engine/parameters.py", line 458, in parse
raise ValueError(message)

ValueError: Value must be valid JSON: Extra data: line 1 column 7 (char 6)

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Write a non-json value in a json-type parameter
2.
3.

Actual results:
heat-engine doesn't like it very much

Expected results:
it should not like it but at least give us an indication of where to look at

Additional info:

Comment 1 Kevin Carter 2020-07-29 16:23:04 UTC
*** Bug 1756595 has been marked as a duplicate of this bug. ***

Comment 7 David Rosenfeld 2021-06-07 18:53:44 UTC
In /usr/share/openstack-tripleo-heat-templates/network_data.yaml changed:


allocation_pools: [{'start': '10.0.1.4', 'end': '10.0.1.250'}] to 
allocation_pools: 'start': '10.0.1.4', 'end': '10.0.1.250'

Deployment fails with this message:

2021-06-04 17:26:13.967 371994 ERROR openstack [  admin] Exception updating plan: mapping values are not allowed here
  in "<unicode string>", line 144, column 28:
      allocation_pools: 'start': '10.0.1.4', 'end': '10.0.1.250'

Comment 9 errata-xmlrpc 2021-09-15 07:08:45 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Red Hat OpenStack Platform (RHOSP) 16.2 enhancement advisory), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2021:3483