]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Add internal.sudo subtask. 74/head
authorZack Cerza <zack@cerza.org>
Wed, 4 Sep 2013 17:55:58 +0000 (12:55 -0500)
committerZack Cerza <zack@cerza.org>
Thu, 5 Sep 2013 21:56:11 +0000 (16:56 -0500)
teuthology/run.py
teuthology/task/internal.py

index 840799b8d39424a14d55640c5335e97ebc9a3dd6..184ef79641e7a6060118037980057e9a1166c8bb 100644 (file)
@@ -215,6 +215,7 @@ def main():
             {'internal.base': None},
             {'internal.archive': None},
             {'internal.coredump': None},
+            {'internal.sudo': None},
             {'internal.syslog': None},
             {'internal.timer': None},
             ])
index 162f54e21e87f26680e96acc5022a67574403ab4..1632bca19dbbabec50042316a96e50f50275f0ba 100644 (file)
@@ -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...')