Revision af90d919
b/logic/backend.py | ||
---|---|---|
143 | 143 |
# somewhere. |
144 | 144 |
percentage = int(rprogress) |
145 | 145 |
|
146 |
if percentage < 0 or percentage > 100: |
|
147 |
raise ValueError("Percentage not in range [0, 100]") |
|
146 |
# The percentage may exceed 100%, due to the way |
|
147 |
# snf-progress-monitor tracks bytes read by image handling processes |
|
148 |
percentage = 100 if percentage > 100 else percentage |
|
149 |
if percentage < 0: |
|
150 |
raise ValueError("Percentage cannot be negative") |
|
148 | 151 |
|
149 | 152 |
last_update = vm.buildpercentage |
150 | 153 |
|
b/logic/tests.py | ||
---|---|---|
339 | 339 |
self.assertRaises(ValueError, backend.process_create_progress, |
340 | 340 |
vm, -1, 0) |
341 | 341 |
self.assertRaises(ValueError, backend.process_create_progress, |
342 |
vm, 102, 0) |
|
343 |
self.assertRaises(ValueError, backend.process_create_progress, |
|
344 | 342 |
vm, 'a', 0) |
345 | 343 |
|
346 | 344 |
# This machine is ACTIVE |
Also available in: Unified diff