Mark stack failed when exception raised in resource check

If we get an unexpected exception when checking a resource, try to clean
up by marking the stack as FAILED. The graph traversal will stop if we
can't propagate any more RPC messages, so without this the stack would
be stuck IN_PROGRESS indefinitely.

Change-Id: I56ecfa7a9a328d1435c1f34ab14e56effb81bb21
Closes-Bug: #1703043
This commit is contained in:
Zane Bitter 2017-07-25 16:04:23 -04:00
parent 96847a56dd
commit ec1801931e
1 changed files with 19 additions and 10 deletions

View File

@ -19,6 +19,7 @@ import eventlet.queue
import functools
from oslo_log import log as logging
from oslo_utils import excutils
from heat.common import exception
from heat.engine import resource
@ -280,7 +281,9 @@ class CheckResource(object):
rsrc.current_template_id != tmpl.id):
return
check_resource_done = self._do_check_resource(cnxt, current_traversal,
try:
check_resource_done = self._do_check_resource(cnxt,
current_traversal,
tmpl, resource_data,
is_update,
rsrc, stack,
@ -291,6 +294,12 @@ class CheckResource(object):
self._initiate_propagate_resource(cnxt, resource_id,
current_traversal, is_update,
rsrc, stack)
except BaseException as exc:
with excutils.save_and_reraise_exception():
msg = six.text_type(exc)
LOG.exception("Unexpected exception in resource check.")
self._handle_resource_failure(cnxt, is_update, rsrc.id,
stack, msg)
def load_resource(cnxt, resource_id, resource_data,