From 7b349d5235a736a7b28af1ba8fa237a26c8444fa Mon Sep 17 00:00:00 2001 From: Kyr Shatskyy Date: Mon, 18 Nov 2019 22:47:21 +0100 Subject: [PATCH] misc: drop 'basestring' usage for py3 compat Signed-off-by: Kyr Shatskyy --- teuthology/misc.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/teuthology/misc.py b/teuthology/misc.py index 2cbfd0185f..69150e2e5d 100644 --- a/teuthology/misc.py +++ b/teuthology/misc.py @@ -893,7 +893,7 @@ def wait_until_osds_up(ctx, cluster, remote, ceph_cluster='ceph'): logger=log.getChild('health'), ) j = json.loads('\n'.join(out.split('\n')[1:])) - up = len(filter(lambda o: 'up' in o['state'], j['osds'])) + up = sum(1 for o in j['osds'] if 'up' in o['state']) log.debug('%d of %d OSDs are up' % (up, num_osds)) if up == num_osds: break @@ -967,7 +967,7 @@ def get_clients(ctx, roles): return all remote roles that are clients. """ for role in roles: - assert isinstance(role, basestring) + assert isinstance(role, str) assert 'client.' in role _, _, id_ = split_role(role) (remote,) = ctx.cluster.only(role).remotes.keys() @@ -1094,7 +1094,7 @@ def ssh_keyscan(hostnames, _raise=True): :param _raise: Whether to raise an exception if not all keys are retrieved :returns: A dict keyed by hostname, with the host keys as values """ - if isinstance(hostnames, basestring): + if not isinstance(hostnames, list) and not isinstance(hostnames, dict): raise TypeError("'hostnames' must be a list") hostnames = [canonicalize_hostname(name, user=None) for name in hostnames] -- 2.39.5