mirror of
https://github.com/ceph/ceph
synced 2024-12-26 05:25:09 +00:00
b4d2234376
It might be better to make this unescaped, but that's trickier. Signed-off-by: Sage Weil <sage@inktank.com>
45 lines
1.2 KiB
Python
45 lines
1.2 KiB
Python
import logging
|
|
|
|
from teuthology import misc as teuthology
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
def task(ctx, config):
|
|
"""
|
|
Execute commands on a given role
|
|
|
|
tasks:
|
|
- ceph:
|
|
- kclient: [client.a]
|
|
- exec:
|
|
client.a:
|
|
- echo 'module libceph +p' > /sys/kernel/debug/dynamic_debug/control
|
|
- echo 'module ceph +p' > /sys/kernel/debug/dynamic_debug/control
|
|
- interactive:
|
|
|
|
"""
|
|
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)
|
|
config = dict((id_, a) for id_ in roles)
|
|
|
|
for role, ls in config.iteritems():
|
|
(remote,) = ctx.cluster.only(role).remotes.iterkeys()
|
|
log.info('Running commands on role %s host %s', role, remote.name)
|
|
for c in ls:
|
|
c.replace('$TESTDIR', testdir)
|
|
remote.run(
|
|
args=[
|
|
'sudo',
|
|
'TESTDIR={tdir}'.format(tdir=testdir),
|
|
'bash',
|
|
'-c',
|
|
c],
|
|
)
|
|
|