summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhuangtianhua <huangtianhua@huawei.com>2014-09-24 15:19:24 +0800
committerAngus Salkeld <asalkeld@mirantis.com>2014-10-10 22:18:11 +1000
commit6e1ad898d887514267e3a429c291b2a067ea7e03 (patch)
tree609ec2182cf5d24b4aae8f8dd98057d932ac6c38
parent1e9b2cdd9004c5e1fa3bb1a27830d75ebaebe20c (diff)
downloadheat-6e1ad898d887514267e3a429c291b2a067ea7e03.tar.gz
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
-rw-r--r--heat/engine/service.py4
-rw-r--r--heat/tests/test_engine_service.py9
2 files changed, 10 insertions, 3 deletions
diff --git a/heat/engine/service.py b/heat/engine/service.py
index 913842776..cc99b2c8e 100644
--- a/heat/engine/service.py
+++ b/heat/engine/service.py
@@ -669,6 +669,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)
diff --git a/heat/tests/test_engine_service.py b/heat/tests/test_engine_service.py
index 6ae16f7cf..0d0477e6f 100644
--- a/heat/tests/test_engine_service.py
+++ b/heat/tests/test_engine_service.py
@@ -1422,21 +1422,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)