graceful handling of null project and inventory in workflow

This commit is contained in:
AlanCoding
2017-01-13 16:34:38 -05:00
parent 044df78e11
commit 5bfb0f229c
2 changed files with 9 additions and 1 deletions

View File

@@ -10,6 +10,7 @@ from sets import Set
from django.conf import settings
from django.db import transaction, connection
from django.db.utils import DatabaseError
from django.utils.translation import ugettext_lazy as _
# AWX
from awx.main.models import * # noqa
@@ -123,7 +124,8 @@ class TaskManager():
can_start = job.signal_start(**kv)
if not can_start:
job.status = 'failed'
job.job_explanation = "Workflow job could not start because it was not in the right state or required manual credentials"
job.job_explanation = _("Job spawned from workflow could not start because it "
"was not in the right state or required manual credentials")
job.save(update_fields=['status', 'job_explanation'])
connection.on_commit(lambda: job.websocket_emit_status('failed'))