aboutsummaryrefslogtreecommitdiff
path: root/build-scripts
diff options
context:
space:
mode:
Diffstat (limited to 'build-scripts')
-rwxr-xr-xbuild-scripts/post-build-lava.py48
1 files changed, 31 insertions, 17 deletions
diff --git a/build-scripts/post-build-lava.py b/build-scripts/post-build-lava.py
index 972088f..9815215 100755
--- a/build-scripts/post-build-lava.py
+++ b/build-scripts/post-build-lava.py
@@ -237,6 +237,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')
@@ -279,7 +294,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)
}
@@ -310,21 +325,20 @@ def main():
print config
- lava_token = os.environ.get("LAVA_TOKEN")
- if lava_token == None:
- f = open('/var/run/lava/lava-token')
- lava_token = f.read().strip()
- f.close()
-
- lava_server = os.environ.get("LAVA_SERVER")
- if lava_server == None:
- lava_server = "validation.linaro.org/lava-server/RPC2/"
+ lava_token_f = os.environ.get("LAVA_TOKEN_FILE")
+ if lava_token_f == None:
+ lava_token_f = '/var/run/lava/lava-token'
+ with open(lava_token_f) as fd:
+ lava_token = fd.read().strip()
try:
- server = xmlrpclib.ServerProxy(
- "https://%(lava_user)s:%(lava_token)s@%(lava_server)s" % \
- dict(lava_user=lava_user, lava_token=lava_token,
- lava_server=lava_server))
+ report_url = ("%(schema)s://"
+ "%(lava_user)s:%(lava_token)s@%(lava_server)s") % dict(
+ schema=schema,
+ lava_user=lava_user,
+ lava_token=lava_token,
+ lava_server=lava_server)
+ 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"):
@@ -333,11 +347,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'))