test_server_cfn_init fails due to attribute resolution problem

Bug #1401107 reported by Pavlo Shchelokovskyy
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Undecided
Pavlo Shchelokovskyy

Bug Description

The trace-back is the following

Traceback (most recent call last):
  File "heat_integrationtests/scenario/test_server_cfn_init.py", line 125, in test_server_cfn_init
    self.check_stack()
  File "heat_integrationtests/scenario/test_server_cfn_init.py", line 72, in check_stack
    sid, 'SmokeServer', 'CREATE_COMPLETE')
  File "heat_integrationtests/common/test.py", line 241, in _wait_for_resource_status
    stack_identifier, resource_name)
  File "/usr/local/lib/python2.7/dist-packages/heatclient/v1/resources.py", line 61, in get
    resp, body = self.client.json_request('GET', url_str)
  File "/usr/local/lib/python2.7/dist-packages/heatclient/common/http.py", line 254, in json_request
    resp = self._http_request(url, method, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/heatclient/common/http.py", line 209, in _http_request
    raise exc.from_response(resp)
HTTPBadRequest: ERROR: 'str' object has no attribute 'keys'
Traceback (most recent call last):

  File "/usr/local/lib/python2.7/dist-packages/oslo/messaging/rpc/dispatcher.py", line 134, in _dispatch_and_reply
    incoming.message))

  File "/usr/local/lib/python2.7/dist-packages/oslo/messaging/rpc/dispatcher.py", line 177, in _dispatch
    return self._do_dispatch(endpoint, method, ctxt, args)

  File "/usr/local/lib/python2.7/dist-packages/oslo/messaging/rpc/dispatcher.py", line 123, in _do_dispatch
    result = getattr(endpoint, method)(ctxt, **new_args)

  File "/usr/local/lib/python2.7/dist-packages/osprofiler/profiler.py", line 105, in wrapper
    return f(*args, **kwargs)

  File "/opt/stack/heat/heat/engine/service.py", line 72, in wrapped
    return func(self, ctx, *args, **kwargs)

  File "/opt/stack/heat/heat/engine/service.py", line 1107, in describe_stack_resource
    with_attr=with_attr)

  File "/opt/stack/heat/heat/engine/api.py", line 187, in format_stack_resource
    resource, with_attr)

  File "/opt/stack/heat/heat/engine/api.py", line 133, in format_resource_attributes
    if 'show' in resolver.keys():

AttributeError: 'str' object has no attribute 'keys'

It looks like when getting the details of the server during test, and the server is in_progress, the attributes can not yet be resolved

Revision history for this message
Pavlo Shchelokovskyy (pshchelo) wrote :

this can be reproduced with any template that has a sever in it that takes some time to boot, and quickly issuing

heat resource-show <stack> <server>

after creating a stack.

Offending change id is I842eb89ac42de8d525d2092ff9d02e70daa8a981
https://github.com/openstack/heat/commit/6d8a5cb35cec81b23a71e8c6fa692f8e7b4dca1c

Changed in heat:
assignee: nobody → Pavlo Shchelokovskyy (pshchelo)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

Fix proposed to branch: master
Review: https://review.openstack.org/140766

Changed in heat:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/140766
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=f6986b6097b827e2a4d2da6a1a26391830587cad
Submitter: Jenkins
Branch: master

commit f6986b6097b827e2a4d2da6a1a26391830587cad
Author: Pavlo Shchelokovskyy <email address hidden>
Date: Wed Dec 10 15:35:25 2014 +0000

    Prevent showing 'show' too early

    The logic in format_resource_attributes was succeptible to a failure
    when resource that has 'show' attribute and is early IN_PROGRESS has
    that attribute not populated yet, returning an empty string instead.

    That might happen when asking for resource-show soon enough after
    stack-create, and that is what test_server_cfn_init in
    heat_integrationtests effectively does.

    Change-Id: I37e209042048cb4409fcd27fcf9587b594f3129b
    Closes-Bug: #1401107

Changed in heat:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/140199
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=ffd97b013c4af550ee9ded7a88f3b122fdb32236
Submitter: Jenkins
Branch: master

commit ffd97b013c4af550ee9ded7a88f3b122fdb32236
Author: Anderson Mesquita <email address hidden>
Date: Mon Dec 8 17:29:59 2014 -0800

    Unit test for resource attribute SHOW fix

    The change https://review.openstack.org/#/c/140766 was merged before a
    previous version of this patch (for bug 1400557), but didn't have any
    unit tests. I've removed the fix but left the unit test here.

    Closes-Bug: #1401107
    Change-Id: I788c181ce55f076243f9bbdf791289a5f45c3758

Thierry Carrez (ttx)
Changed in heat:
milestone: none → kilo-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in heat:
milestone: kilo-1 → 2015.1.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.