Resource create/update/delete failures not always caught

Bug #1130270 reported by Steven Hardy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
High
Steven Hardy
Grizzly
Fix Released
High
Steven Hardy

Bug Description

We have a (broken IMO) pattern where resource.create(), resource.update() and resource.delete() are treated as having failed if they return a value, e.g:

result = res.create()
if result:
    stack_status = self.CREATE_FAILED

The problem is if any Exception gets raised without a string description we return an empty string, which is treated as if no error has occurred.

E.g try putting "raise Exception()" in any resource handle_create - result is an empty string so result is evaluated as False and the resource will not be set to CREATE_FAILED state.

The quick fix is to replace all the Exception-return-as-string bits in resource.py:

return str(ex)

with:

return str(ex) or "Error : %s" % type(ex)

Or something similar, but longer term, I think we need to look at this pattern and replace it with re-raising an Exception so it can be caught e.g in parser.py instead of relying on the non-standard error-if-it-returns-a-value behavior.

Steven Hardy (shardy)
Changed in heat:
status: New → Triaged
importance: Undecided → High
assignee: nobody → Steven Hardy (shardy)
description: updated
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/22336

Changed in heat:
status: Triaged → In Progress
Steven Hardy (shardy)
Changed in heat:
milestone: none → grizzly-3
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/22336
Committed: http://github.com/openstack/heat/commit/2f4b981cd4a373cb66af935558e2ed3a779dd202
Submitter: Jenkins
Branch: master

commit 2f4b981cd4a373cb66af935558e2ed3a779dd202
Author: Steven Hardy <email address hidden>
Date: Tue Feb 19 18:17:02 2013 +0000

    heat engine : avoid returning empty resource error strings

    Avoid the possibility of returning an empty string (when Exceptions
    have not got a string message), or parser.py will treat the error
    as success and the resource operation failure will not be correctly
    reflected in the resource state.

    fixes bug 1130270

    Change-Id: I1c55dea1f9615cd4b037802ff8c1066694bffea6

Changed in heat:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in heat:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in heat:
milestone: grizzly-3 → 2013.1
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.