From: Ondrej Lichtner <olichtne(a)redhat.com>
Sometimes the job finished message could arrive from the slave before
the job started message which would lead to an inverse ordering that
couldn't be shortened by the ResultFormatter into a single line. It's
also a little confusing to see that a job finished before it was
started.
This fixes the issue by pre-emptively adding a successful
JobStartedResult to the current_run result log and changing it's
"success" attribute once the result from the slave is known.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Controller/Machine.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/lnst/Controller/Machine.py b/lnst/Controller/Machine.py
index f727062..25cdf03 100644
--- a/lnst/Controller/Machine.py
+++ b/lnst/Controller/Machine.py
@@ -353,10 +353,12 @@ def run_job(self, job):
if job._desc is not None:
logging.info("Job description: %s" % job._desc)
- res = self.rpc_call("run_job", job._to_dict(), netns=job.netns)
+ job_result = JobStartResult(job, True)
+ self._recipe.current_run.add_result(job_result)
+ job_result.success = self.rpc_call("run_job", job._to_dict(),
+ netns=job.netns)
- self._recipe.current_run.add_result(JobStartResult(job, res))
- return res
+ return job_result.success
def wait_for_job(self, job, timeout):
if job.id not in self._jobs:
--
2.21.0