[Branch,~linaro-validation/lava-scheduler/trunk] Rev 265: Fix bug #1224261 - submitting a multinode job for a device_type with no

Message ID 20130912144623.30669.25132.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Senthil Kumaran Sept. 12, 2013, 2:46 p.m.
Merge authors:
  Senthil Kumaran S (stylesen)
Related merge proposals:
  https://code.launchpad.net/~stylesen/lava-scheduler/fix-bug-1224261/+merge/185207
  proposed by: Senthil Kumaran S (stylesen)
  review: Approve - Neil Williams (codehelp)
------------------------------------------------------------
revno: 265 [merge]
committer: Senthil Kumaran <senthil.kumaran@linaro.org>
branch nick: trunk
timestamp: Thu 2013-09-12 20:15:31 +0530
message:
  Fix bug #1224261 - submitting a multinode job for a device_type with no
  boards fails.
modified:
  lava_scheduler_app/models.py
  lava_scheduler_app/views.py


--
lp:lava-scheduler
https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk

You are subscribed to branch lp:lava-scheduler.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk/+edit-subscription

Patch

=== modified file 'lava_scheduler_app/models.py'
--- lava_scheduler_app/models.py	2013-09-04 14:46:59 +0000
+++ lava_scheduler_app/models.py	2013-09-12 06:28:07 +0000
@@ -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'
--- lava_scheduler_app/views.py	2013-09-02 15:14:15 +0000
+++ lava_scheduler_app/views.py	2013-09-12 06:28:07 +0000
@@ -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(