If a stack was created using a version of Heat from RHEL-OSP 7 or earlier, listing resources for the stack would fail beginning with the Heat version from OSP 10, with an error calculating the 'required_by' data. In addition, even for stacks created with later versions of Heat the 'required_by' field was not populated, unless the convergence_engine option was enabled (which is the default starting with OSP 10) at the time the stack was created. Heat now correctly populates the 'required_by' field without error.
Description of problem:
heat resource-list fails with error :
heatclient.exc.HTTPBadRequest: ERROR: The server could not comply with the request since it is either malformed or otherwise incorrect.
The heat-api logs the error :
-------------------------------------------------------------------------------
2017-05-09 14:58:12.711 5591 ERROR heat.common.wsgi [req-44df7a52-381a-46e3-95ab-6eed0641e2ca 381092704d7148a4afbdbb626f73ce99 1ec8f1ff4c114b1b93f0015a77b52865 - default default] Exception handling resource: arg
ument of type 'NoneType' is not iterable
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/server.py", line 133, in _process_incoming
res = self.dispatcher.dispatch(message)
File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 150, in dispatch
return self._do_dispatch(endpoint, method, ctxt, args)
File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 121, in _do_dispatch
result = func(ctxt, **new_args)
File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 154, in wrapper
return f(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/heat/common/context.py", line 424, in wrapped
return func(self, ctx, *args, **kwargs)
File "/usr/lib/python2.7/site-packages/heat/engine/service.py", line 1945, in list_stack_resources
for resource in rsrcs]
File "/usr/lib/python2.7/site-packages/heat/engine/api.py", line 345, in format_stack_resource
rpc_api.RES_REQUIRED_BY: resource.required_by(),
File "/usr/lib/python2.7/site-packages/heat/engine/resource.py", line 659, in required_by
if r.id in self.needed_by]
TypeError: argument of type 'NoneType' is not iterable
-------------------------------------------------------------------------------
Version-Release number of selected component (if applicable):
openstack-heat-api.noarch 1:7.0.2-4.el7ost @rhel-7-server-openstack-10-rpms
openstack-heat-api-cfn.noarch 1:7.0.2-4.el7ost @rhel-7-server-openstack-10-rpms
openstack-heat-api-cloudwatch.noarch
openstack-heat-common.noarch 1:7.0.2-4.el7ost @rhel-7-server-openstack-10-rpms
openstack-heat-engine.noarch 1:7.0.2-4.el7ost @rhel-7-server-openstack-10-rpms
How reproducible:
Always .
Steps to Reproduce:
1. Modify heat.resource table :
MariaDB [heat]> update resource set needed_by = 'null' where uuid='0b1bab2d-ba42-4f45-b547-7642a737760f';
2. Run heat resource-list
Review cmd error output & api error .
3. Run following to fix it back:
MariaDB [heat]> update resource set needed_by = '[]' where uuid='0b1bab2d-ba42-4f45-b547-7642a737760f';
Actual results:
DB has wrong entry of needed_by & resource list fails with above error .
Expected results:
DB entries do not have 'null' .
Additional info:
On further analysis it was identified that a large number of entries in heat.resource table has needed_by & requires as string value 'null' .
Where as default environment these two values are always set as '[]' .
Having null in the database is not a problem per se. The problem is that we're hitting a code path that we're not intending to hit unless the value has been updated to [].
That said, updating the database to contain [] instead of null would work, and wouldn't have any negative consequences.
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, 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/RHBA-2017:3099
Description of problem: heat resource-list fails with error : heatclient.exc.HTTPBadRequest: ERROR: The server could not comply with the request since it is either malformed or otherwise incorrect. The heat-api logs the error : ------------------------------------------------------------------------------- 2017-05-09 14:58:12.711 5591 ERROR heat.common.wsgi [req-44df7a52-381a-46e3-95ab-6eed0641e2ca 381092704d7148a4afbdbb626f73ce99 1ec8f1ff4c114b1b93f0015a77b52865 - default default] Exception handling resource: arg ument of type 'NoneType' is not iterable Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/server.py", line 133, in _process_incoming res = self.dispatcher.dispatch(message) File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 150, in dispatch return self._do_dispatch(endpoint, method, ctxt, args) File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 121, in _do_dispatch result = func(ctxt, **new_args) File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 154, in wrapper return f(*args, **kwargs) File "/usr/lib/python2.7/site-packages/heat/common/context.py", line 424, in wrapped return func(self, ctx, *args, **kwargs) File "/usr/lib/python2.7/site-packages/heat/engine/service.py", line 1945, in list_stack_resources for resource in rsrcs] File "/usr/lib/python2.7/site-packages/heat/engine/api.py", line 345, in format_stack_resource rpc_api.RES_REQUIRED_BY: resource.required_by(), File "/usr/lib/python2.7/site-packages/heat/engine/resource.py", line 659, in required_by if r.id in self.needed_by] TypeError: argument of type 'NoneType' is not iterable ------------------------------------------------------------------------------- Version-Release number of selected component (if applicable): openstack-heat-api.noarch 1:7.0.2-4.el7ost @rhel-7-server-openstack-10-rpms openstack-heat-api-cfn.noarch 1:7.0.2-4.el7ost @rhel-7-server-openstack-10-rpms openstack-heat-api-cloudwatch.noarch openstack-heat-common.noarch 1:7.0.2-4.el7ost @rhel-7-server-openstack-10-rpms openstack-heat-engine.noarch 1:7.0.2-4.el7ost @rhel-7-server-openstack-10-rpms How reproducible: Always . Steps to Reproduce: 1. Modify heat.resource table : MariaDB [heat]> update resource set needed_by = 'null' where uuid='0b1bab2d-ba42-4f45-b547-7642a737760f'; 2. Run heat resource-list Review cmd error output & api error . 3. Run following to fix it back: MariaDB [heat]> update resource set needed_by = '[]' where uuid='0b1bab2d-ba42-4f45-b547-7642a737760f'; Actual results: DB has wrong entry of needed_by & resource list fails with above error . Expected results: DB entries do not have 'null' . Additional info: On further analysis it was identified that a large number of entries in heat.resource table has needed_by & requires as string value 'null' . Where as default environment these two values are always set as '[]' .