diff mbox

[Branch,~linaro-validation/lava-scheduler/trunk] Rev 228: reject jobs with invalid server urls at submit time

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

Commit Message

Michael-Doyle Hudson Nov. 30, 2012, 12:13 a.m. UTC
------------------------------------------------------------
revno: 228
committer: Michael Hudson-Doyle <michael.hudson@linaro.org>
branch nick: trunk
timestamp: Fri 2012-11-30 13:11:57 +1300
message:
  reject jobs with invalid server urls at submit time
modified:
  lava_scheduler_app/models.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
diff mbox

Patch

=== modified file 'lava_scheduler_app/models.py'
--- lava_scheduler_app/models.py	2012-11-14 16:46:33 +0000
+++ lava_scheduler_app/models.py	2012-11-30 00:11:57 +0000
@@ -1,5 +1,6 @@ 
 import logging
 import simplejson
+import urlparse
 
 from django.conf import settings
 from django.contrib.auth.models import User
@@ -420,6 +421,11 @@ 
                 user, group, is_public = (bundle_stream.user,
                                           bundle_stream.group,
                                           bundle_stream.is_public)
+            server = action['parameters']['server']
+            parsed_server = urlparse.urlsplit(server)
+            if parsed_server.hostname is None:
+                raise ValueError("invalid server: %s" % server)
+
 
         tags = []
         for tag_name in job_data.get('device_tags', []):