[fix] Microdecision : do not miserably crash if the lock does not exist when attempting to release it

This commit is contained in:
Alexandre Aubin 2019-04-08 18:15:00 +02:00
parent 06646931b1
commit 0e16546af9

View file

@ -497,7 +497,10 @@ class MoulinetteLock(object):
"""
if self._locked:
if os.path.exists(self._lockfile):
os.unlink(self._lockfile)
else:
logger.warning("Uhoh, somehow the lock %s did not exist ..." % self._lockfile)
logger.debug('lock has been released')
self._locked = False