diff --git a/kolla_cli/commands/group.py b/kolla_cli/commands/group.py index fc272ee..120118e 100644 --- a/kolla_cli/commands/group.py +++ b/kolla_cli/commands/group.py @@ -114,6 +114,25 @@ class GroupRemovehost(Command): raise Exception(traceback.format_exc()) +class GroupList(Lister): + """Only list all groups """ + + def take_action(self, parsed_args): + try: + data = [('',)] + groups = CLIENT.group_get_all() + if groups: + data = [] + for group in groups: + data.append((group.get_name(),)) + data = convert_lists_to_string(data, parsed_args) + return ((u._('Group'), ), sorted(data)) + except ClientException as e: + raise CommandError(str(e)) + except Exception as e: + raise Exception(traceback.format_exc()) + + class GroupListhosts(Lister): """List all groups and their hosts.""" diff --git a/setup.cfg b/setup.cfg index 90cbb3b..a1335d9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -45,6 +45,7 @@ kolla.cli = getdeploy = kolla_cli.commands.mode:Getdeploy group_add = kolla_cli.commands.group:GroupAdd group_addhost = kolla_cli.commands.group:GroupAddhost + group_list = kolla_cli.commands.group:GroupList group_listhosts = kolla_cli.commands.group:GroupListhosts group_listservices = kolla_cli.commands.group:GroupListservices group_remove = kolla_cli.commands.group:GroupRemove