Commit c2b3619d authored by Guillaume Tucker's avatar Guillaume Tucker
Browse files

Show message when a running device has no current job in devices table



In some cases, a device can be in the "running" state but still not
have any current job associated with it.  This causes some exceptions,
as the code tries to get a `.pk` attribute from a None object.  The
root cause of the problem is likely due to some glitch in the state
machine, where the device state changes before the new job has been
associated with it.  Work around this by printing a message with "(no
current job)" when this happens, to avoid an exception and to help
debug the root cause of the problem.
Signed-off-by: Guillaume Tucker's avatarGuillaume Tucker <guillaume.tucker@collabora.com>
parent e4ca21aa
......@@ -85,6 +85,8 @@ class ExpandedStatusColumn(tables.Column):
"""
if record.state == Device.STATE_RUNNING:
current_job = record.current_job()
if not current_job:
return mark_safe("(no current job)")
return mark_safe( # nosec - internal data
"Running job #%s - %s submitted by %s"
% (pklink(current_job), current_job.description, current_job.submitter)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment