mirror of
https://github.com/ansible/awx.git
synced 2026-05-20 07:17:40 -02:30
Merge pull request #5457 from AlanCoding/always_release_lock
Fix situation were error happened before lock was released Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
@@ -2215,6 +2215,8 @@ class RunProjectUpdate(BaseTask):
|
|||||||
copy_tree(project_path, destination_folder)
|
copy_tree(project_path, destination_folder)
|
||||||
|
|
||||||
def post_run_hook(self, instance, status):
|
def post_run_hook(self, instance, status):
|
||||||
|
# To avoid hangs, very important to release lock even if errors happen here
|
||||||
|
try:
|
||||||
if self.playbook_new_revision:
|
if self.playbook_new_revision:
|
||||||
instance.scm_revision = self.playbook_new_revision
|
instance.scm_revision = self.playbook_new_revision
|
||||||
instance.save(update_fields=['scm_revision'])
|
instance.save(update_fields=['scm_revision'])
|
||||||
@@ -2233,6 +2235,7 @@ class RunProjectUpdate(BaseTask):
|
|||||||
except Exception:
|
except Exception:
|
||||||
# this could have failed due to dirty tree, but difficult to predict all cases
|
# this could have failed due to dirty tree, but difficult to predict all cases
|
||||||
logger.exception('Failed to restore project repo to prior state after {}'.format(instance.log_format))
|
logger.exception('Failed to restore project repo to prior state after {}'.format(instance.log_format))
|
||||||
|
finally:
|
||||||
self.release_lock(instance)
|
self.release_lock(instance)
|
||||||
p = instance.project
|
p = instance.project
|
||||||
if instance.job_type == 'check' and status not in ('failed', 'canceled',):
|
if instance.job_type == 'check' and status not in ('failed', 'canceled',):
|
||||||
|
|||||||
Reference in New Issue
Block a user