From 50cbd80650655338b7563966083388b564f8567c Mon Sep 17 00:00:00 2001 From: Zane Bitter Date: Mon, 17 Dec 2012 19:56:22 +0100 Subject: [PATCH] Fix issues with deleting a WaitCondition Previously we were ignoring the reference to the WaitConditionHandle stored in the database by always setting it to None on load. This meant that we had to try to recreate it on delete, which would fail if e.g. the WaitConditionHandle had already been deleted. bug 1089354 Change-Id: Ibc4145348a91b455e97ba27748ff72451b0c7bce Signed-off-by: Zane Bitter --- heat/engine/resources/wait_condition.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/heat/engine/resources/wait_condition.py b/heat/engine/resources/wait_condition.py index 23c07e01..0d849549 100644 --- a/heat/engine/resources/wait_condition.py +++ b/heat/engine/resources/wait_condition.py @@ -143,7 +143,6 @@ class WaitCondition(resource.Resource): def __init__(self, name, json_snippet, stack): super(WaitCondition, self).__init__(name, json_snippet, stack) - self.resource_id = None self.timeout = int(self.t['Properties']['Timeout']) self.count = int(self.t['Properties'].get('Count', '1')) @@ -151,12 +150,10 @@ class WaitCondition(resource.Resource): self.timeout / self.SLEEP_DIV), self.MIN_SLEEP) - def _get_handle_resource_id(self): - if self.resource_id is None: - handle_url = self.properties['Handle'] - handle_id = identifier.ResourceIdentifier.from_arn_url(handle_url) - self.resource_id_set(handle_id.resource_name) - return self.resource_id + def _get_handle_resource_name(self): + handle_url = self.properties['Handle'] + handle_id = identifier.ResourceIdentifier.from_arn_url(handle_url) + return handle_id.resource_name def _get_status_reason(self, handle): return (handle.metadata.get('Status', WAITING), @@ -171,7 +168,9 @@ class WaitCondition(resource.Resource): # keep polling our Metadata to see if the cfn-signal has written # it yet. The execution here is limited by timeout. with self._create_timeout() as tmo: - handle = self.stack[self._get_handle_resource_id()] + handle_res_name = self._get_handle_resource_name() + handle = self.stack[handle_res_name] + self.resource_id_set(handle_res_name) (status, reason) = (WAITING, '') @@ -197,7 +196,6 @@ class WaitCondition(resource.Resource): return self.UPDATE_REPLACE def handle_delete(self): - self._get_handle_resource_id() if self.resource_id is None: return -- 2.45.2