summaryrefslogtreecommitdiff
path: root/tko
diff options
context:
space:
mode:
authormbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4>2009-07-28 23:27:42 +0000
committermbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4>2009-07-28 23:27:42 +0000
commit1c955e09123aba5da7da858d34f189711a50142b (patch)
tree2ace7e122200f50ce9ed12d5267523cc192d3d94 /tko
parente552b793557d3d0793d9b32cdb04456a0e7459d8 (diff)
Update retrieve logs to allow for a more dynamic site_retrieve_logs that can
return a host. Rename retrieve_hosts site function to site_retrieve_hosts Add host:port support to get_full_url Signed-off-by: Scott Zawalski <scottz@google.com> git-svn-id: svn://test.kernel.org/autotest/trunk@3470 592f7852-d20e-0410-864c-8624ca9c26a4
Diffstat (limited to 'tko')
-rwxr-xr-xtko/retrieve_logs.cgi22
1 files changed, 17 insertions, 5 deletions
diff --git a/tko/retrieve_logs.cgi b/tko/retrieve_logs.cgi
index 75b0a33d..dc9b8bb1 100755
--- a/tko/retrieve_logs.cgi
+++ b/tko/retrieve_logs.cgi
@@ -16,10 +16,15 @@ Location: %s\r\n\r
def _retrieve_logs_dummy(job_path):
pass
-retrieve_logs = utils.import_site_function(__file__,
- "autotest_lib.tko.site_retrieve_logs", "retrieve_logs",
+site_retrieve_logs = utils.import_site_function(__file__,
+ "autotest_lib.tko.site_retrieve_logs", "site_retrieve_logs",
_retrieve_logs_dummy)
+site_find_repository_host = utils.import_site_function(__file__,
+ "autotest_lib.tko.site_retrieve_logs", "site_find_repository_host",
+ _retrieve_logs_dummy)
+
+
form = cgi.FieldStorage(keep_blank_values=True)
# determine if this is a JSON-RPC request. we support both so that the new TKO
# client can use its RPC client code, but the old TKO can still use simple GET
@@ -47,12 +52,15 @@ def find_repository_host(job_path):
for drone in results_repos:
http_path = 'http://%s%s' % (drone, job_path)
try:
- urllib2.urlopen(http_path)
+ utils.urlopen(http_path)
if drone == 'localhost':
return None
return drone
except urllib2.URLError:
pass
+ site_host = site_find_repository_host(log_path)
+ if site_host:
+ return site_host
# just return the results repo if we haven't found any
return results_host
else:
@@ -61,7 +69,11 @@ def find_repository_host(job_path):
def get_full_url(host, path):
if host:
- prefix = 'http://' + utils.normalize_hostname(host)
+ if ':' in host:
+ host, port = host.split(':')
+ prefix = 'http://%s:%s' % (utils.normalize_hostname(host), port)
+ else:
+ prefix = 'http://%s' % utils.normalize_hostname(host)
else:
prefix = ''
@@ -73,6 +85,6 @@ def get_full_url(host, path):
log_path = _get_requested_path()
-retrieve_logs(log_path)
host = find_repository_host(log_path)
+site_retrieve_logs(log_path)
print _PAGE % get_full_url(host, log_path)