From d6e8b2337f53ff0176650b9a4cb53815a8046625 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Wed, 4 Sep 2013 12:55:58 -0500 Subject: [PATCH] Add internal.sudo subtask. --- teuthology/run.py | 1 + teuthology/task/internal.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/teuthology/run.py b/teuthology/run.py index 840799b8..184ef796 100644 --- a/teuthology/run.py +++ b/teuthology/run.py @@ -215,6 +215,7 @@ def main(): {'internal.base': None}, {'internal.archive': None}, {'internal.coredump': None}, + {'internal.sudo': None}, {'internal.syslog': None}, {'internal.timer': None}, ]) diff --git a/teuthology/task/internal.py b/teuthology/task/internal.py index 162f54e2..1632bca1 100644 --- a/teuthology/task/internal.py +++ b/teuthology/task/internal.py @@ -322,6 +322,24 @@ def archive(ctx, config): ), ) +@contextlib.contextmanager +def sudo(ctx, config): + log.info('Configuring sudo...') + sudoers_file = '/etc/sudoers' + tty_expr = 's/requiretty/!requiretty/' + pw_expr = 's/!visiblepw/visiblepw/' + + run.wait( + ctx.cluster.run( + args="sudo sed -i -e '{tty_expr}' -e '{pw_expr}' {path}".format( + tty_expr=tty_expr, pw_expr=pw_expr, path=sudoers_file + ), + wait=False, + ) + ) + yield + + @contextlib.contextmanager def coredump(ctx, config): log.info('Enabling coredump saving...') -- 2.47.3