exec, pexec: set TESTDIR

Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
Sage Weil 2013-02-25 09:59:21 -08:00 committed by Alex Elder
parent 31ef4a1276
commit d7337364a3
2 changed files with 12 additions and 3 deletions

View 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],

View 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])