summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2014-10-17 15:27:15 +0300
committerPedro Alvarez <pedro.alvarez@codethink.co.uk>2014-10-22 15:51:07 +0100
commit58fdfa14e8148e19fe27036eaa2b3e9e55a93887 (patch)
treea177d03498ff60a17ac52025f450a580fb4134fe
parent4efbdabd77d2ec71766d2ab140198964202884e1 (diff)
downloadlorry-controller-58fdfa14e8148e19fe27036eaa2b3e9e55a93887.tar.gz
Handle case when there is no disk usage info
Use 0 instead. This was exposed by a test suite change: test suite creates a dummy job, but doesn't fill in all the fields. With this change, WEBAPP doesn't crash when it tries to report a job's information when not all fields are filled in.
-rw-r--r--lorrycontroller/showjob.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/lorrycontroller/showjob.py b/lorrycontroller/showjob.py
index 951ad22..bc82bfe 100644
--- a/lorrycontroller/showjob.py
+++ b/lorrycontroller/showjob.py
@@ -39,7 +39,7 @@ class JobShower(object):
'path': statedb.get_job_path(job_id),
'exit': 'no' if exit is None else exit,
'disk_usage': disk_usage,
- 'disk_usage_nice': self.format_bytesize(disk_usage),
+ 'disk_usage_nice': self.format_bytesize(disk_usage or 0),
'output': output,
'job_started': self.format_time(started),
'job_ended': '' if ended is None else self.format_time(ended),