]>
git.proxmox.com Git - ceph.git/blob - ceph/qa/tasks/tox.py
5 from teuthology
import misc
as teuthology
6 from teuthology
.orchestra
import run
8 log
= logging
.getLogger(__name__
)
11 def get_toxvenv_dir(ctx
):
12 return '{tdir}/tox-venv'.format(tdir
=teuthology
.get_testdir(ctx
))
14 @contextlib.contextmanager
15 def task(ctx
, config
):
17 Deploy tox from pip. It's a dependency for both Keystone and Tempest.
19 assert config
is None or isinstance(config
, list) \
20 or isinstance(config
, dict), \
21 "task tox only supports a list or dictionary for configuration"
22 all_clients
= ['client.{id}'.format(id=id_
)
23 for id_
in teuthology
.all_roles_of_type(ctx
.cluster
, 'client')]
26 if isinstance(config
, list):
27 config
= dict.fromkeys(config
)
29 log
.info('Deploying tox from pip...')
30 for (client
, _
) in config
.items():
31 # yup, we have to deploy tox first. The packaged one, available
32 # on Sepia's Ubuntu machines, is outdated for Keystone/Tempest.
33 tvdir
= get_toxvenv_dir(ctx
)
34 ctx
.cluster
.only(client
).run(args
=[ 'virtualenv', '-p', 'python3', tvdir
])
35 ctx
.cluster
.only(client
).run(args
=
36 [ 'source', '{tvdir}/bin/activate'.format(tvdir
=tvdir
),
38 'pip', 'install', 'tox==3.15.0'
41 # export the path Keystone and Tempest
42 ctx
.tox
= argparse
.Namespace()
43 ctx
.tox
.venv_path
= get_toxvenv_dir(ctx
)
48 for (client
, _
) in config
.items():
49 ctx
.cluster
.only(client
).run(
50 args
=[ 'rm', '-rf', get_toxvenv_dir(ctx
) ])