From 61ab197b3aa12ed6001dcf5f69dd678b30f7d138 Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Mon, 24 Mar 2014 14:57:53 -0400 Subject: [PATCH] If we fail the prestart check on a job, record the conditions by which we fail --- awx/main/models/jobs.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/awx/main/models/jobs.py b/awx/main/models/jobs.py index e08b628b09..27ac1e86e0 100644 --- a/awx/main/models/jobs.py +++ b/awx/main/models/jobs.py @@ -407,6 +407,8 @@ class Job(CommonTask): from awx.main.tasks import handle_work_error task_class = self._get_task_class() if not self.can_start: + self.result_traceback = "Job is not in a startable status: %s, expecting one of %s" % (self.status, str(('new', 'waiting'))) + self.save() return False needed = self._get_passwords_needed_to_start() try: @@ -418,6 +420,8 @@ class Job(CommonTask): else: opts = dict([(field, stored_args.get(field, '')) for field in needed]) if not all(opts.values()): + self.result_traceback = "Missing needed fields: %s" % str(opts.values()) + self.save() return False task_class().apply_async((self.pk,), opts, link_error=error_callback) return True