aboutsummaryrefslogtreecommitdiff
path: root/build-scripts/post-build-lava.py
diff options
context:
space:
mode:
authorYongqin Liu <yongqin.liu@linaro.org>2012-08-13 15:47:47 +0800
committerYongqin Liu <yongqin.liu@linaro.org>2012-08-13 15:47:47 +0800
commit4e8998eb2a29ee864bc12508459a8253d6a1fd66 (patch)
tree0d486007296e83a6daaaa1aee76311a350fc9993 /build-scripts/post-build-lava.py
parentda23cfc6c7af05a86d671276f071a0c1f5ffde15 (diff)
also change the url for submit result
Diffstat (limited to 'build-scripts/post-build-lava.py')
-rwxr-xr-xbuild-scripts/post-build-lava.py45
1 files changed, 22 insertions, 23 deletions
diff --git a/build-scripts/post-build-lava.py b/build-scripts/post-build-lava.py
index 53d5c4e..2365d4e 100755
--- a/build-scripts/post-build-lava.py
+++ b/build-scripts/post-build-lava.py
@@ -216,6 +216,21 @@ def main():
print "Don't know how to test this board. Skip testing."
return
+ lava_server = os.environ.get("LAVA_SERVER")
+ if lava_server == None:
+ schema = 'https'
+ url_no_schema = "validation.linaro.org/lava-server/RPC2/"
+ elif lava_server.find('://') >= 0:
+ schema = lava_server[:lava_server.find('://')]
+ url_no_schema = lava_server[lava_server.find('://') + len('://'):]
+ else:
+ ## the case that no https and http specified in the url
+ ## like: validation.linaro.org/lava-server/RPC2/
+ schema = 'https'
+ url_no_schema = lava_server #for compare with above condition
+ schema_url = '%s://%s' % (schema, url_no_schema)
+ lava_server = url_no_schema
+
lava_user = os.environ.get("LAVA_USER")
if lava_user == None:
f = open('/var/run/lava/lava-user')
@@ -258,7 +273,7 @@ def main():
"command": "submit_results_on_host",
"parameters":
{
- "server": "http://validation.linaro.org/lava-server/RPC2/",
+ "server": schema_url,
"stream": PRODUCT_MAP[target_product].get(
"test_stream", default_stream)
}
@@ -295,30 +310,14 @@ def main():
with open(lava_token_f) as fd:
lava_token = fd.read().strip()
- lava_server = os.environ.get("LAVA_SERVER")
- if lava_server == None:
- lava_server_protocol = 'https'
- lava_server = "validation.linaro.org/lava-server/RPC2/"
- elif lava_server.startswith('http://'):
- lava_server_protocol = 'http'
- lava_server = lava_server[len('http://'):]
- elif lava_server.startswith('https://'):
- lava_server_protocol = 'https'
- lava_server = lava_server[len('https://'):]
- else:
- ## the case that no https and http specified in the url
- ## like: validation.linaro.org/lava-server/RPC2/
- lava_server_protocol = 'https'
- lava_server = lava_server #for compare with above condition
-
try:
- url = ("%(lava_server_protocol)s://"
+ report_url = ("%(schema)s://"
"%(lava_user)s:%(lava_token)s@%(lava_server)s") % dict(
- lava_server_protocol=lava_server_protocol,
+ schema=schema,
lava_user=lava_user,
lava_token=lava_token,
lava_server=lava_server)
- server = xmlrpclib.ServerProxy(url)
+ server = xmlrpclib.ServerProxy(report_url)
lava_job_id = server.scheduler.submit_job(config)
lava_server_root = lava_server.rstrip("/")
if lava_server_root.endswith("/RPC2"):
@@ -327,11 +326,11 @@ def main():
print "Error making a LAVA request:", obfuscate_credentials(str(e))
sys.exit(1)
- print "LAVA Job Id: %s, URL: http://%s/scheduler/job/%s" % \
- (lava_job_id, lava_server_root, lava_job_id)
+ print "LAVA Job Id: %s, URL: %s://%s/scheduler/job/%s" % \
+ (lava_job_id, schema, lava_server_root, lava_job_id)
json.dump({
- 'lava_url': "http://" + lava_server_root,
+ 'lava_url': "%s://%s" % (schema, lava_server_root),
'job_id': lava_job_id,
}, open('out/lava-job-info', 'w'))