Don't change INIT_COMPLETE resources to CHECK_COMPLETE

We assume that only resources that are in INIT_COMPLETE need to be created
(as opposed to updated). If we run a check on a resource that hasn't been
created yet, we shouldn't change the status to CHECK_COMPLETE because
thereafter we will try to update it.

Changing the status to CHECK_FAILED (as we do if the resource supports
handle_check()) is OK because the resource will get replaced on the next
update anyway.

Change-Id: Iaadf3b57b0e8edc76d338c017dbd05bf2a37698f
Story: #2003062
Task: 23102
This commit is contained in:
Zane Bitter 2018-07-20 16:53:20 -04:00
parent 8ca06cfeaf
commit cd5c0583d6
1 changed files with 4 additions and 0 deletions

View File

@ -1739,6 +1739,10 @@ class Resource(status.ResourceStatus):
with self.frozen_properties():
return self._do_action(action)
else:
if self.state == (self.INIT, self.COMPLETE):
# No need to store status; better to leave the resource in
# INIT_COMPLETE than imply that we've checked and it exists.
return
reason = '%s not supported for %s' % (action, self.type())
self.state_set(action, self.COMPLETE, reason)