aboutsummaryrefslogtreecommitdiff
path: root/build-scripts/post-build-lava.py
diff options
context:
space:
mode:
authorYongqin Liu <yongqin.liu@linaro.org>2012-08-13 13:34:09 +0800
committerYongqin Liu <yongqin.liu@linaro.org>2012-08-13 13:34:09 +0800
commitda23cfc6c7af05a86d671276f071a0c1f5ffde15 (patch)
treea51caa619e7c6bff4321b3e02be4bacd00ea0317 /build-scripts/post-build-lava.py
parent1fd1c97155b7b4b157f389102ef43d6ab4fe8a61 (diff)
add support for http lava-server, and stop to use the LAVA_TOKEN variable
Diffstat (limited to 'build-scripts/post-build-lava.py')
-rwxr-xr-xbuild-scripts/post-build-lava.py33
1 files changed, 24 insertions, 9 deletions
diff --git a/build-scripts/post-build-lava.py b/build-scripts/post-build-lava.py
index b7acb12..53d5c4e 100755
--- a/build-scripts/post-build-lava.py
+++ b/build-scripts/post-build-lava.py
@@ -289,21 +289,36 @@ 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_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()
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:
- 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))
+ url = ("%(lava_server_protocol)s://"
+ "%(lava_user)s:%(lava_token)s@%(lava_server)s") % dict(
+ lava_server_protocol=lava_server_protocol,
+ lava_user=lava_user,
+ lava_token=lava_token,
+ lava_server=lava_server)
+ server = xmlrpclib.ServerProxy(url)
lava_job_id = server.scheduler.submit_job(config)
lava_server_root = lava_server.rstrip("/")
if lava_server_root.endswith("/RPC2"):