Ignore NotFound exception in metadata_set

To avoid a race condition when updating a deleted stack, this catches the
NotFound exception specifically and ignores it.  All other exceptions are
allowed to be raised.

Closes bug: 1582236

Change-Id: I23ddb71c806c0db1ed7ed4ee4ef831ca51605d65
This commit is contained in:
Jaime Guerrero 2016-05-26 16:06:28 +00:00
parent 2759ba7e55
commit c789a9837e
1 changed files with 5 additions and 1 deletions

View File

@ -11,6 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from heat.common.exception import NotFound
from oslo_utils import timeutils
import six
@ -64,4 +65,7 @@ class CooldownMixin(object):
now = timeutils.utcnow().isoformat()
metadata['cooldown'] = {now: cooldown_reason}
metadata['scaling_in_progress'] = False
self.metadata_set(metadata)
try:
self.metadata_set(metadata)
except NotFound:
pass