Log the error when a resouce fails to delete

Also bail out of handle_delete if instance_id is None

Change-Id: I2bd77345ac35860201006a23999a06dd81ac6fe0
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
This commit is contained in:
Angus Salkeld 2012-07-24 19:04:07 +10:00
parent f1eabe8073
commit 8c3f0f14a5
3 changed files with 6 additions and 0 deletions

View File

@ -287,6 +287,8 @@ class Instance(resources.Resource):
'''
Delete an instance, blocking until it is disposed by OpenStack
'''
if self.instance_id is None:
return
try:
server = self.nova().servers.get(self.instance_id)
except NotFound:

View File

@ -559,6 +559,8 @@ class Stack(object):
for res in reversed(self):
result = res.destroy()
if result:
logger.error('Failed to delete %s error: %s' % (str(res),
result))
failures.append(str(res))
if failures:

View File

@ -60,6 +60,8 @@ class User(Resource):
return self.UPDATE_REPLACE
def handle_delete(self):
if self.instance_id is None:
return
try:
user = self.keystone().users.get(DummyId(self.instance_id))
except Exception as ex: