]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
exec, pexec: set TESTDIR
authorSage Weil <sage@inktank.com>
Mon, 25 Feb 2013 17:59:21 +0000 (09:59 -0800)
committerAlex Elder <elder@inktank.com>
Mon, 25 Feb 2013 21:12:56 +0000 (15:12 -0600)
Signed-off-by: Sage Weil <sage@inktank.com>
teuthology/task/exec.py
teuthology/task/pexec.py

index a914101e4021220dcca79784ff501d7225caeb55..00994e078cd51b694c9f74a97f929f797c933840 100644 (file)
@@ -21,6 +21,8 @@ def task(ctx, config):
     log.info('Executing custom commands...')
     assert isinstance(config, dict), "task exec got invalid config"
 
+    testdir = teuthology.get_testdir(ctx)
+
     if 'all' in config and len(config) == 1:
         a = config['all']
         roles = teuthology.all_roles(ctx.cluster)
@@ -33,6 +35,7 @@ def task(ctx, config):
             remote.run(
                 args=[
                     'sudo',
+                    'TESTDIR={tdir}'.format(tdir=testdir),
                     'bash',
                     '-c',
                     c],
index 72d9e3f3944a0d70cd34274048b018060684190e..3659907a87bd8ff09803dfba7806ce3ba3d964de 100644 (file)
@@ -28,11 +28,16 @@ def _do_barrier(barrier, barrier_queue, remote):
     else:
         barrier.wait()
 
-def _exec_host(barrier, barrier_queue, remote, sudo, ls):
+def _exec_host(barrier, barrier_queue, remote, sudo, testdir, ls):
     log.info('Running commands on host %s', remote.name)
-    args = ['bash', '-s']
+    args = [
+        'TESTDIR={tdir}'.format(tdir=testdir),
+        'bash',
+        '-s'
+        ]
     if sudo:
         args.insert(0, 'sudo')
+    
     r = remote.run( args=args, stdin=tor.PIPE, wait=False)
     r.stdin.writelines(['set -e\n'])
     r.stdin.flush()
@@ -123,6 +128,7 @@ def task(ctx, config):
         sudo = config['sudo']
         del config['sudo']
 
+    testdir = teuthology.get_testdir(ctx)
 
     remotes = list(_generate_remotes(ctx, config))
     count = len(remotes)
@@ -133,4 +139,4 @@ def task(ctx, config):
         _init_barrier(barrier_queue, remote[0])
     with parallel() as p:
         for remote in remotes:
-            p.spawn(_exec_host, barrier, barrier_queue, remote[0], sudo, remote[1])
+            p.spawn(_exec_host, barrier, barrier_queue, remote[0], sudo, testdir, remote[1])