diff options
author | Lars Wirzenius <liw@liw.fi> | 2014-10-17 15:27:15 +0300 |
---|---|---|
committer | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2014-10-22 15:51:07 +0100 |
commit | 58fdfa14e8148e19fe27036eaa2b3e9e55a93887 (patch) | |
tree | a177d03498ff60a17ac52025f450a580fb4134fe /lorrycontroller | |
parent | 4efbdabd77d2ec71766d2ab140198964202884e1 (diff) | |
download | lorry-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.
Diffstat (limited to 'lorrycontroller')
-rw-r--r-- | lorrycontroller/showjob.py | 2 |
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), |