Do not attempt a stack update when it is deleting

If a stack is in any delete state(inprogress, failed),
don't attempt to update it.

Closes-bug: #1379113
Change-Id: I1de99702a385ac8ddeffc568270d2d3b51674323
This commit is contained in:
huangtianhua 2014-09-24 15:19:24 +08:00
parent 2d669b4f8b
commit 16e767b271
2 changed files with 10 additions and 3 deletions

View File

@ -691,6 +691,10 @@ class EngineService(service.Service):
msg = _('Updating a stack when it is suspended')
raise exception.NotSupported(feature=msg)
if current_stack.action == current_stack.DELETE:
msg = _('Updating a stack when it is deleting')
raise exception.NotSupported(feature=msg)
# Now parse the template and any parameters for the updated
# stack definition.
tmpl = templatem.Template(template, files=files)

View File

@ -1428,21 +1428,24 @@ class StackServiceCreateUpdateDeleteTest(HeatTestCase):
six.text_type(ex))
class StackServiceUpdateSuspendedNotSupportedTest(HeatTestCase):
class StackServiceUpdateActionsNotSupportedTest(HeatTestCase):
scenarios = [
('suspend_in_progress', dict(action='SUSPEND', status='IN_PROGRESS')),
('suspend_complete', dict(action='SUSPEND', status='COMPLETE')),
('suspend_failed', dict(action='SUSPEND', status='FAILED')),
('delete_in_progress', dict(action='DELETE', status='IN_PROGRESS')),
('delete_complete', dict(action='DELETE', status='COMPLETE')),
('delete_failed', dict(action='DELETE', status='FAILED')),
]
def setUp(self):
super(StackServiceUpdateSuspendedNotSupportedTest, self).setUp()
super(StackServiceUpdateActionsNotSupportedTest, self).setUp()
self.ctx = utils.dummy_context()
self.patch('heat.engine.service.warnings')
self.man = service.EngineService('a-host', 'a-topic')
def test_stack_update_suspended(self):
def test_stack_update_actions_not_supported(self):
stack_name = '%s-%s' % (self.action, self.status)
old_stack = get_wordpress_stack(stack_name, self.ctx)