output-show for parameter accessing incorrect attribute returns 'null'

Bug #1368041 reported by Unmesh Gurjar
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-heatclient
Fix Released
Medium
Unmesh Gurjar

Bug Description

Branch: master

Description:
For resources like ResourceGroup, the output parameters are not validated during stack creation (bug #1368039). When a stack has an output parameter which accesses an incorrect attribute of a ResourceGroup resource, the output-show command returns the string 'null'. Returning a 'null' value for an output parameter will convey incorrect information to the user. Instead, returning an error indicating the invalid attribute access would be helpful.

Scenario:
1. Create a stack (named 'mystack') using the attached template (which has an output accessing an incorrect attribute of resource OS::Nova::Server).
2. Upon completion of stack, issue the 'heat output-show mystack instance1_ip' and observe the output.

Actual result:
The text 'null' gets displayed.

Expected behavior:
The command should return an error indicating the incorrect attribute being accessed. As in this case, returning a 'null' would convey incorrect meaning that the server resource was not allocated an IP address.

Revision history for this message
Unmesh Gurjar (unmesh-gurjar) wrote :
Changed in python-heatclient:
assignee: nobody → Unmesh Gurjar (unmesh-gurjar)
Revision history for this message
Steve Baker (steve-stevebaker) wrote :

The problem is that some attributes appear dynamically later in the resource's life-cycle, so raising an error for an attribute which isn't there *yet* isn't appropriate.

Revision history for this message
Unmesh Gurjar (unmesh-gurjar) wrote :

I agree for such attributes we cannot raise an error. But in cases like this, where the output of GET stack (sample http://paste.openstack.org/show/110507/ ), where there is an 'output_error' present for an output attribute, it is conclusive of an incorrect attribute access. Therefore, we can raise an error in such scenario. Does it sound appropriate?

Revision history for this message
Angus Salkeld (asalkeld) wrote :

 {"output_value": null,
  "output_error": "The Referenced Attribute (0 PublicIp) is incorrect.",
  "description": "The IP address of first instance",
  "output_key": "instance1_ip"}

The "output_error" is only there when there is an error.
This seems good to me, what would you want to do differently?

Revision history for this message
Unmesh Gurjar (unmesh-gurjar) wrote :

I would want to tweak output-show to return the error (i.e. the message in output_error field ) instead of the 'null' value.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-heatclient (master)

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

Changed in python-heatclient:
status: New → In Progress
Changed in python-heatclient:
importance: Undecided → Medium
Revision history for this message
Visnusaran Murugan (visnusaran-murugan) wrote :

IMO, regardless of error or success message, output_value should hold them. There should be an additional error flag to determine how output_value is consumed.

tags: added: juno-rc-potential
Revision history for this message
Thierry Carrez (ttx) wrote :

python-heatclient is not released withe the integrated release, so removing tag

tags: removed: juno-rc-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-heatclient (master)

Reviewed: https://review.openstack.org/123993
Committed: https://git.openstack.org/cgit/openstack/python-heatclient/commit/?id=a2bb6c965f104810782eabb0ee7c0d357cfcb4c7
Submitter: Jenkins
Branch: master

commit a2bb6c965f104810782eabb0ee7c0d357cfcb4c7
Author: Unmesh Gurjar <email address hidden>
Date: Wed Sep 10 13:11:22 2014 +0530

    Fixed null str returned for incorrect parameter

    For resources like ResourceGroup, the output parameters are not
    validated during stack creation. When a stack has an output parameter
    which accesses an incorrect attribute of a resource, the output-show
    command returns the string 'null'.
    This fix instead returns an error indicating the incorrect attribute
    being accessed.

    Change-Id: I51eea4738bfefb35644a384ec6d4e9176c8f2e26
    Closes-bug: #1368041

Changed in python-heatclient:
status: In Progress → Fix Committed
Changed in python-heatclient:
milestone: none → v0.3.0
Changed in python-heatclient:
status: Fix Committed → Fix Released
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.