From c1ba27632120ce6bd0a78c556315e83e4053f8e5 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Wed, 11 Sep 2013 09:45:46 -0500 Subject: [PATCH] Move get_http_log_path --- teuthology/misc.py | 12 ++++++++++++ teuthology/suite.py | 12 ++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/teuthology/misc.py b/teuthology/misc.py index 2a4a924ff2..7725e9efc3 100644 --- a/teuthology/misc.py +++ b/teuthology/misc.py @@ -16,6 +16,7 @@ import json from teuthology import safepath from teuthology import lockstatus from .orchestra import run +from .config import config log = logging.getLogger(__name__) @@ -25,6 +26,7 @@ is_vm = lambda x: x.startswith('vpm') or x.startswith('ubuntu@vpm') is_arm = lambda x: x.startswith('tala') or x.startswith('ubuntu@tala') or x.startswith('saya') or x.startswith('ubuntu@saya') + def get_testdir(ctx): if 'test_path' in ctx.teuthology_config: return ctx.teuthology_config['test_path'] @@ -34,6 +36,7 @@ def get_testdir(ctx): # this on the server side, it won't work properly. return ctx.teuthology_config.get('test_path', '/home/%s/cephtest' % test_user) + def get_test_user(ctx): """ :returns: str -- the user to run tests as on remote hosts @@ -45,6 +48,15 @@ def get_archive_dir(ctx): test_dir = get_testdir(ctx) return os.path.normpath(os.path.join(test_dir, 'archive')) + +def get_http_log_path(archive_dir, job_id): + http_base = config.archive_server + if not http_base: + return None + archive_subdir = os.path.split(archive_dir)[-1] + return os.path.join(http_base, archive_subdir, str(job_id), '') + + def get_ceph_binary_url(package=None, branch=None, tag=None, sha1=None, dist=None, flavor=None, format=None, arch=None): diff --git a/teuthology/suite.py b/teuthology/suite.py index 0f79519dd1..1e21d0568a 100644 --- a/teuthology/suite.py +++ b/teuthology/suite.py @@ -447,14 +447,6 @@ def _results(args): generate_coverage(args) -def get_http_log_path(archive_dir, job_id): - http_base = config.archive_server - if not http_base: - return None - archive_subdir = os.path.split(archive_dir)[-1] - return os.path.join(http_base, archive_subdir, str(job_id), '') - - def get_jobs(archive_dir): dir_contents = os.listdir(archive_dir) @@ -540,7 +532,7 @@ def build_email_body(name, archive_dir, timeout): time=int(summary.get('duration')), ) else: - log = get_http_log_path(archive_dir, job) + log = teuthology.get_http_log_path(archive_dir, job) if log: log_line = email_templates['fail_log_templ'].format(log=log) else: @@ -601,7 +593,7 @@ def build_email_body(name, archive_dir, timeout): body = email_templates['body_templ'].format( name=name, - log_root=get_http_log_path(archive_dir, ''), + log_root=teuthology.get_http_log_path(archive_dir, ''), fail_count=len(failed), hung_count=len(hung), pass_count=len(passed), -- 2.39.5