No error's reported if heat stack creation/update fails

Adds error status reason text to exception message that is raised
when Heat stack create/update fails

Also disables stack rollback for consistency (otherwise if error happens during
stack creation it silently disappears and no reason provided)

Change-Id: Ia4366cba486e9ce4c5ae35ecb3e042bbf5f7ef3d
Closes-Bug: #1369722
This commit is contained in:
Stan Lagun
2014-09-26 18:47:47 +04:00
parent 387d309b4a
commit f901e9acfa
2 changed files with 6 additions and 4 deletions

View File

@@ -168,8 +168,10 @@ class HeatStack(murano_object.MuranoObject):
eventlet.sleep(2)
continue
if not status_func(status):
reason = ': {0}'.format(
stack_info.stack_status_reason) if stack_info else ''
raise EnvironmentError(
"Unexpected stack state {0}".format(status))
"Unexpected stack state {0}{1}".format(status, reason))
try:
return dict([(t['output_key'], t['output_value'])
@@ -202,7 +204,7 @@ class HeatStack(murano_object.MuranoObject):
stack_name=self._name,
parameters=self._parameters,
template=template,
disable_rollback=False)
disable_rollback=True)
self._wait_state(
lambda status: status == 'CREATE_COMPLETE')

View File

@@ -58,7 +58,7 @@ class TestHeatStack(base.MuranoTestCase):
}
mock_heat_client.stacks.create.assert_called_with(
stack_name='test-stack',
disable_rollback=False,
disable_rollback=True,
parameters={},
template=expected_template
)
@@ -91,7 +91,7 @@ class TestHeatStack(base.MuranoTestCase):
}
mock_heat_client.stacks.create.assert_called_with(
stack_name='test-stack',
disable_rollback=False,
disable_rollback=True,
parameters={},
template=expected_template
)