[Branch,~linaro-validation/lava-scheduler/trunk] Rev 263: Fix bug #1224260 - split_multi_job makes assumptions about the job JSON that

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

Commit Message

Senthil Kumaran Sept. 12, 2013, 8:20 a.m.
Merge authors:
  Senthil Kumaran S (stylesen)
Related merge proposals:
  https://code.launchpad.net/~stylesen/lava-scheduler/fix-bug-1224260/+merge/185211
  proposed by: Senthil Kumaran S (stylesen)
  review: Approve - Neil Williams (codehelp)
------------------------------------------------------------
revno: 263 [merge]
committer: Senthil Kumaran <senthil.kumaran@linaro.org>
branch nick: trunk
timestamp: Thu 2013-09-12 13:49:58 +0530
message:
  Fix bug #1224260 - split_multi_job makes assumptions about the job JSON that
  are not enforced by the schema.
  
  Respect parameters that are marked as optional in the job schema.
modified:
  lava_scheduler_app/utils.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/utils.py'
--- lava_scheduler_app/utils.py	2013-09-02 16:22:57 +0000
+++ lava_scheduler_app/utils.py	2013-09-12 07:07:01 +0000
@@ -81,15 +81,21 @@ 
         for c in range(0, count):
             node_json[role].append({})
             node_json[role][c]["timeout"] = json_jobdata["timeout"]
-            node_json[role][c]["job_name"] = json_jobdata["job_name"]
-            node_json[role][c]["tags"] = clients["tags"]
+            if json_jobdata.get("job_name", False):
+                node_json[role][c]["job_name"] = json_jobdata["job_name"]
+            if clients.get("tags", False):
+                node_json[role][c]["tags"] = clients["tags"]
             node_json[role][c]["group_size"] = group_count
             node_json[role][c]["target_group"] = target_group
             node_json[role][c]["actions"] = node_actions[role]
 
             node_json[role][c]["role"] = role
             # multinode node stage 2
-            node_json[role][c]["logging_level"] = json_jobdata["logging_level"]
+            if json_jobdata.get("logging_level", False):
+                node_json[role][c]["logging_level"] = \
+                    json_jobdata["logging_level"]
+            if json_jobdata.get("priority", False):
+                node_json[role][c]["priority"] = json_jobdata["priority"]
             node_json[role][c]["device_type"] = clients["device_type"]
 
     return node_json