From: Zane Bitter Date: Fri, 3 May 2013 14:07:14 +0000 (+0200) Subject: Set Stack id to None when deleted X-Git-Tag: 2014.1~650 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=c9fa7375d426068e639710d662f44e246e0b1241;p=openstack-build%2Fheat-build.git Set Stack id to None when deleted If a Stack object has been removed from the database, we should reset its ID to None so that if the object is used further, it will not be assumed that it is represented in the database. Change-Id: Iaa7e9327324f101487847362973bd7f8386ce44b --- diff --git a/heat/engine/parser.py b/heat/engine/parser.py index 81c782fc..d11c7605 100644 --- a/heat/engine/parser.py +++ b/heat/engine/parser.py @@ -525,6 +525,7 @@ class Stack(object): elif action == self.ROLLBACK: self.state_set(self.ROLLBACK_COMPLETE, 'Rollback completed') db_api.stack_delete(self.context, self.id) + self.id = None def output(self, key): ''' diff --git a/heat/tests/utils.py b/heat/tests/utils.py index fed91f67..3b5d5ffd 100644 --- a/heat/tests/utils.py +++ b/heat/tests/utils.py @@ -45,7 +45,8 @@ def stack_delete_after(test_fn): test_fn(test_cls) finally: try: - test_cls.stack.delete() + if test_cls.stack.id is not None: + test_cls.stack.delete() except AttributeError: pass return wrapped_test