Fix lint and Python 3 compatibility.
from __future__ import absolute_import
-import six
-
from oslo_config import cfg
from st2common import config
@@ -27,13 +25,15 @@ from st2common.services import coordination
Tool which lists all the services registered in the service registry and their capabilities.
"""
+
def main(group_id=None):
coordinator = coordination.get_coordinator()
if not group_id:
group_ids = list(coordinator.get_groups().get())
+ group_ids = [group_id.decode('utf-8') for group_id in group_ids]
- print('Available groups:')
+ print('Available groups (%s):' % (len(group_ids)))
for group_id in group_ids:
print(' - %s' % (group_id))
print('')
@@ -41,8 +41,10 @@ def main(group_id=None):
group_ids = [group_id]
for group_id in group_ids:
- print('Members in group "%s":' % (group_id))
member_ids = list(coordinator.get_members(group_id).get())
+ member_ids = [member_id.decode('utf-8') for member_id in member_ids]
+
+ print('Members in group "%s" (%s):' % (group_id, len(member_ids)))
for member_id in member_ids:
capabilities = coordinator.get_member_capabilities(group_id, member_id).get()
