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.

Closes-Bug: #1851502
Change-Id: I1f15441ef31f530758f1588e8006cc6b17d3aeaf
Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com>
(cherry picked from commit 0b77267d5e)
This commit is contained in:
Bogdan Dobrelya 2019-10-09 14:58:00 +02:00 committed by Alex Schultz
parent 03890e20d5
commit 962f0a33ad
2 changed files with 2 additions and 2 deletions

View File

@ -1146,7 +1146,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)

View File

@ -19,4 +19,4 @@ from tripleo_common.utils.locks import base
class ThreadingLock(base.BaseLock):
def __init__(self):
self._lock = threading.Lock()
self._objects = set()
self._objects = []