1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 16:51:11 +03:00

check EACCES and only refresh cancel_flag

This commit is contained in:
Wayne Witzel III 2018-05-18 14:00:33 -04:00
parent 5279b102cb
commit 9fe44cfaae

View File

@ -1672,14 +1672,14 @@ class RunProjectUpdate(BaseTask):
start_time = time.time()
while True:
try:
instance.refresh_from_db()
instance.refresh_from_db(fields=['cancel_flag'])
if instance.cancel_flag:
logger.info(six.text_type("ProjectUpdate({0}) was cancelled".format(instance.pk)))
return
fcntl.flock(self.lock_fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
break
except IOError as e:
if e.errno != errno.EAGAIN:
if e.errno not in (errno.EAGAIN, errno.EACCES):
os.close(self.lock_fd)
logger.error(six.text_type("I/O error({0}) while trying to aquire lock on file [{1}]: {2}").format(e.errno, lock_path, e.strerror))
raise