From 0b77267d5e974fcb1b759410a94bdb236e96852d Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya Date: Wed, 9 Oct 2019 14:58:00 +0200 Subject: [PATCH] Fix dynamic executor appending to objects Set() has no the append() method. Unify the _objects to be always assigned a list. Take the safer remove() approach for the non-unique locks, if any happened in the image uploader locks manager. Change-Id: I1f15441ef31f530758f1588e8006cc6b17d3aeaf Signed-off-by: Bogdan Dobrelya --- tripleo_common/image/image_uploader.py | 2 +- tripleo_common/utils/locks/threadinglock.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tripleo_common/image/image_uploader.py b/tripleo_common/image/image_uploader.py index f76958c40..917631731 100644 --- a/tripleo_common/image/image_uploader.py +++ b/tripleo_common/image/image_uploader.py @@ -1152,7 +1152,7 @@ class PythonImageUploader(BaseImageUploader): LOG.debug('Starting acquire for lock %s' % layer) with lock.get_lock(): LOG.debug('Acquired for unlock %s' % layer) - if layer in lock.objects(): + while layer in lock.objects(): lock.objects().remove(layer) LOG.debug('Updated lock info %s' % layer) LOG.debug('Released lock on layer %s' % layer) diff --git a/tripleo_common/utils/locks/threadinglock.py b/tripleo_common/utils/locks/threadinglock.py index 14f582f3f..5e47edc97 100644 --- a/tripleo_common/utils/locks/threadinglock.py +++ b/tripleo_common/utils/locks/threadinglock.py @@ -19,4 +19,4 @@ import threading class ThreadingLock(base.BaseLock): def __init__(self): self._lock = threading.Lock() - self._objects = set() + self._objects = []