]>
git.proxmox.com Git - ceph.git/blob - ceph/qa/tasks/exec_on_cleanup.py
2 Exececute custom commands during unwind/cleanup
7 from teuthology
import misc
as teuthology
9 log
= logging
.getLogger(__name__
)
11 @contextlib.contextmanager
12 def task(ctx
, config
):
14 Execute commands on a given role
21 - "echo 'module libceph +p' > /sys/kernel/debug/dynamic_debug/control"
22 - "echo 'module ceph +p' > /sys/kernel/debug/dynamic_debug/control"
25 It stops and fails with the first command that does not return on success. It means
26 that if the first command fails, the second won't run at all.
28 To avoid confusion it is recommended to explicitly enclose the commands in
29 double quotes. For instance if the command is false (without double quotes) it will
30 be interpreted as a boolean by the YAML parser.
33 :param config: Configuration
38 log
.info('Executing custom commands...')
39 assert isinstance(config
, dict), "task exec got invalid config"
41 testdir
= teuthology
.get_testdir(ctx
)
43 if 'all' in config
and len(config
) == 1:
45 roles
= teuthology
.all_roles(ctx
.cluster
)
46 config
= dict((id_
, a
) for id_
in roles
)
48 for role
, ls
in config
.items():
49 (remote
,) = ctx
.cluster
.only(role
).remotes
.keys()
50 log
.info('Running commands on role %s host %s', role
, remote
.name
)
52 c
.replace('$TESTDIR', testdir
)
56 'TESTDIR={tdir}'.format(tdir
=testdir
),