=== modified file 'lava_scheduler_app/models.py'
@@ -81,7 +81,7 @@
continue
else:
raise DevicesUnavailableException(
- "Requested %d %s device(s) - only %d available." % (count, board, all_devices[board]))
+ "Requested %d %s device(s) - only %d available." % (count, board, all_devices.get(board,0)))
return True
=== modified file 'lava_scheduler_app/views.py'
@@ -53,6 +53,7 @@
TestJob,
JSONDataError,
validate_job_json,
+ DevicesUnavailableException,
)
@@ -606,7 +607,8 @@
"lava_scheduler_app/job_submit.html",
response_data, RequestContext(request))
- except (JSONDataError, ValueError) as e:
+ except (JSONDataError, ValueError, DevicesUnavailableException) \
+ as e:
response_data["error"] = str(e)
response_data["json_input"] = request.POST.get("json-input")
return render_to_response(
@@ -842,7 +844,7 @@
response_data, RequestContext(request))
else:
return redirect(job)
- except Exception as e:
+ except (JSONDataError, ValueError, DevicesUnavailableException) as e:
response_data["error"] = str(e)
response_data["json_input"] = definition
return render_to_response(