From b53bd0ca965a6d32b419a24432d978228bf3299c Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Tue, 1 Dec 2015 11:44:07 -0700 Subject: [PATCH] misc: Use newer config API Signed-off-by: Zack Cerza --- teuthology/misc.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/teuthology/misc.py b/teuthology/misc.py index 9ea7a421cb..6280bccc04 100644 --- a/teuthology/misc.py +++ b/teuthology/misc.py @@ -129,25 +129,25 @@ def merge_configs(config_paths): return conf_dict -def get_testdir(ctx): +def get_testdir(ctx=None): """ + :param ctx: Unused; accepted for compatibility :returns: A test directory """ - if 'test_path' in ctx.teuthology_config: - return ctx.teuthology_config['test_path'] - test_user = get_test_user(ctx) - # FIXME this ideally should use os.path.expanduser() in the future, in case - # $HOME isn't /home/$USER - e.g. on a Mac. However, since we're executing - # this on the server side, it won't work properly. - return ctx.teuthology_config.get('test_path', '/home/%s/cephtest' % - test_user) + if 'test_path' in config: + return config['test_path'] + return config.get( + 'test_path', + '/home/%s/cephtest' % get_test_user() + ) -def get_test_user(ctx): +def get_test_user(ctx=None): """ - :returns: str -- the user to run tests as on remote hosts + :param ctx: Unused; accepted for compatibility + :returns: str -- the user to run tests as on remote hosts """ - return ctx.teuthology_config.get('test_user', 'ubuntu') + return config.get('test_user', 'ubuntu') def get_archive_dir(ctx): -- 2.39.5