From c9fa7375d426068e639710d662f44e246e0b1241 Mon Sep 17 00:00:00 2001 From: Zane Bitter Date: Fri, 3 May 2013 16:07:14 +0200 Subject: [PATCH] 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 --- heat/engine/parser.py | 1 + heat/tests/utils.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) 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 -- 2.45.2