Make sure the resource exists before trying to update it.
Change-Id: I5d8bdc0f4ceff61cab0b909dcaaf8ab5952ba4af Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
This commit is contained in:
parent
f0b75758f6
commit
4a19ab5903
@ -137,11 +137,14 @@ class Resource(object):
|
|||||||
|
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
logger.warn('db error %s' % str(ex))
|
logger.warn('db error %s' % str(ex))
|
||||||
elif new_state is not self.CREATE_IN_PROGRESS:
|
elif self.id is not None:
|
||||||
rs = db_api.resource_get(None, self.id)
|
try:
|
||||||
rs.update_and_save({'state': new_state})
|
rs = db_api.resource_get(self.stack.context, self.id)
|
||||||
if rs.stack:
|
rs.update_and_save({'state': new_state})
|
||||||
rs.stack.update_and_save({'updated_at': datetime.utcnow()})
|
if rs.stack:
|
||||||
|
rs.stack.update_and_save({'updated_at': datetime.utcnow()})
|
||||||
|
except Exception as ex:
|
||||||
|
logger.warn('db error %s' % str(ex))
|
||||||
|
|
||||||
if new_state != self.state:
|
if new_state != self.state:
|
||||||
ev = {}
|
ev = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user