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
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()
: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]