mirror of
https://github.com/ceph/ceph
synced 2025-01-19 01:21:49 +00:00
Move get_clients method into misc to avoid duplication.
This commit is contained in:
parent
256e6a2bbc
commit
0904ce550d
@ -283,3 +283,12 @@ def write_secret_file(remote, role, filename):
|
||||
filename,
|
||||
],
|
||||
)
|
||||
|
||||
def get_clients(ctx, roles):
|
||||
for role in roles:
|
||||
assert isinstance(role, basestring)
|
||||
PREFIX = 'client.'
|
||||
assert role.startswith(PREFIX)
|
||||
id_ = role[len(PREFIX):]
|
||||
(remote,) = ctx.cluster.only(role).remotes.iterkeys()
|
||||
yield (id_, remote)
|
||||
|
@ -7,16 +7,6 @@ from orchestra import run
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
def get_clients(ctx, roles):
|
||||
for role in roles:
|
||||
assert isinstance(role, basestring)
|
||||
PREFIX = 'client.'
|
||||
assert role.startswith(PREFIX)
|
||||
id_ = role[len(PREFIX):]
|
||||
(remote,) = ctx.cluster.only(role).remotes.iterkeys()
|
||||
yield (id_, remote)
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def task(ctx, config):
|
||||
"""
|
||||
@ -50,7 +40,7 @@ def task(ctx, config):
|
||||
if config is None:
|
||||
config = ['client.{id}'.format(id=id_)
|
||||
for id_ in teuthology.all_roles_of_type(ctx.cluster, 'client')]
|
||||
clients = list(get_clients(ctx=ctx, roles=config))
|
||||
clients = list(teuthology.get_clients(ctx=ctx, roles=config))
|
||||
|
||||
for id_, remote in clients:
|
||||
mnt = os.path.join('/tmp/cephtest', 'mnt.{id}'.format(id=id_))
|
||||
|
@ -6,16 +6,6 @@ from teuthology import misc as teuthology
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
def get_clients(ctx, roles):
|
||||
for role in roles:
|
||||
assert isinstance(role, basestring)
|
||||
PREFIX = 'client.'
|
||||
assert role.startswith(PREFIX)
|
||||
id_ = role[len(PREFIX):]
|
||||
(remote,) = ctx.cluster.only(role).remotes.iterkeys()
|
||||
yield (id_, remote)
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def task(ctx, config):
|
||||
"""
|
||||
@ -48,7 +38,7 @@ def task(ctx, config):
|
||||
if config is None:
|
||||
config = ['client.{id}'.format(id=id_)
|
||||
for id_ in teuthology.all_roles_of_type(ctx.cluster, 'client')]
|
||||
clients = list(get_clients(ctx=ctx, roles=config))
|
||||
clients = list(teuthology.get_clients(ctx=ctx, roles=config))
|
||||
|
||||
for id_, remote in clients:
|
||||
log.debug('Mounting client client.{id}...'.format(id=id_))
|
||||
|
Loading…
Reference in New Issue
Block a user