Wrong error handling in Outputs section in CFN templates

Bug #1386332 reported by Peter Razumovsky
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Undecided
Peter Razumovsky

Bug Description

1) Output empty body
1.
HeatTemplateFormatVersion: '2012-12-12'
Resources:
  Resource:
    Type: OS::Nova::FloatingIP
Outputs:
  Output:
2.
$ heat stack-create test -f test.yaml
ERROR: 'NoneType' object has no attribute 'get'
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 73, in wrapped
    return func(self, ctx, *args, **kwargs)

  File "/opt/stack/heat/heat/engine/service.py", line 663, in create_stack
    owner_id)

  File "/opt/stack/heat/heat/engine/service.py", line 586, in _parse_template_and_validate_stack
    stack.validate()

  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/stack.py", line 479, in validate
    snippet = val.get('Value', '')

AttributeError: 'NoneType' object has no attribute 'get'

2) String in output body instead of mapping
1.
 HeatTemplateFormatVersion: '2012-12-12'
Resources:
  Resource:
    Type: OS::Nova::FloatingIP
Outputs:
  Output:
    Wrong body, sorry!
2.
$ heat stack-create test -f test.yaml
ERROR: 'unicode' object has no attribute 'get'
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 73, in wrapped
    return func(self, ctx, *args, **kwargs)

  File "/opt/stack/heat/heat/engine/service.py", line 724, in update_stack
    updated_stack.validate()

  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/stack.py", line 479, in validate
    snippet = val.get('Value', '')

AttributeError: 'unicode' object has no attribute 'get'

Changed in heat:
assignee: nobody → Razumovsky Peter (prazumovsky)
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/131222

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/131222
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=5cf44d99ccef9f2bdf28f303696409855da340a4
Submitter: Jenkins
Branch: master

commit 5cf44d99ccef9f2bdf28f303696409855da340a4
Author: Peter Razumovsky <email address hidden>
Date: Mon Oct 27 20:20:20 2014 +0300

    Fix error raising in cfn with wrong output section

    There is a situation, when output object in cfn template
    has empty body. In this situation we got traceback instead
    of error message, this is incorrect. Furthermore, if output
    body is a string, we got traceback too. Follow AWS template
    format docs (UserGuide), every output object must contain
    property 'Value'. So corresponding error should be raised.

    Change-Id: I0d7e3e57e479ddb658645b8664bc847866180cda
    Closes-bug: #1386332

Changed in heat:
status: In Progress → Fix Committed
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.

Other bug subscribers

Remote bug watches

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