From 0a6af7d8326a287b1f5d1554253b9d3c15661202 Mon Sep 17 00:00:00 2001 From: Zane Bitter Date: Wed, 6 Mar 2013 16:21:03 +0100 Subject: [PATCH] Use built-in exception filtering for GreenletExit Python handles this natively. Change-Id: I440b87112826f44f4c9c3b4bbdd161d2e202341b --- heat/engine/resource.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/heat/engine/resource.py b/heat/engine/resource.py index 7458e517..e3e1a2a1 100644 --- a/heat/engine/resource.py +++ b/heat/engine/resource.py @@ -300,16 +300,12 @@ class Resource(object): self.handle_create() while not self.check_active(): eventlet.sleep(1) + except greenlet.GreenletExit: + raise except Exception as ex: - # If we get a GreenletExit exception, the create thread has - # been killed so we should raise allowing this thread to exit - if type(ex) is greenlet.GreenletExit: - logger.warning('GreenletExit during create, exiting') - raise - else: - logger.exception('create %s', str(self)) - self.state_set(self.CREATE_FAILED, str(ex)) - return str(ex) or "Error : %s" % type(ex) + logger.exception('create %s', str(self)) + self.state_set(self.CREATE_FAILED, str(ex)) + return str(ex) or "Error : %s" % type(ex) else: self.state_set(self.CREATE_COMPLETE) -- 2.45.2