mirror of
https://github.com/ansible/awx.git
synced 2026-01-15 11:50:42 -03:30
Fail job run if project is failed
provide message in traceback and explanation fields add log messages for dependency spawns
This commit is contained in:
parent
6df26eb7a3
commit
b790b50a1a
@ -285,6 +285,11 @@ class TaskManager():
|
||||
project_task.created = task.created - timedelta(seconds=1)
|
||||
project_task.status = 'pending'
|
||||
project_task.save()
|
||||
logger.info(
|
||||
'Spawned {} as dependency of {}'.format(
|
||||
project_task.log_format, task.log_format
|
||||
)
|
||||
)
|
||||
return project_task
|
||||
|
||||
def create_inventory_update(self, task, inventory_source_task):
|
||||
@ -294,6 +299,11 @@ class TaskManager():
|
||||
inventory_task.created = task.created - timedelta(seconds=2)
|
||||
inventory_task.status = 'pending'
|
||||
inventory_task.save()
|
||||
logger.info(
|
||||
'Spawned {} as dependency of {}'.format(
|
||||
inventory_task.log_format, task.log_format
|
||||
)
|
||||
)
|
||||
# inventory_sources = self.get_inventory_source_tasks([task])
|
||||
# self.process_inventory_sources(inventory_sources)
|
||||
return inventory_task
|
||||
|
||||
@ -1381,6 +1381,12 @@ class RunJob(BaseTask):
|
||||
if job.is_isolated() is True:
|
||||
pu_ig = pu_ig.controller
|
||||
pu_en = settings.CLUSTER_HOST_ID
|
||||
if job.project.status in ('error', 'failed'):
|
||||
msg = _(
|
||||
'The project revision for this job template is unknown due to a failed update.'
|
||||
)
|
||||
job = self.update_model(job.pk, status='failed', job_explanation=msg)
|
||||
raise RuntimeError(msg)
|
||||
local_project_sync = job.project.create_project_update(
|
||||
_eager_fields=dict(
|
||||
launch_type="sync",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user