From b79f8e04625864c645d37928dc90bde41ec5345d Mon Sep 17 00:00:00 2001 From: Jana Cupova Date: Sep 03 2021 09:11:32 +0000 Subject: [PATCH 1/2] Fix disabled and enabled option when empty result Fixes: https://pagure.io/koji/issue/3015 --- diff --git a/cli/koji_cli/commands.py b/cli/koji_cli/commands.py index 9f67540..0edbac4 100644 --- a/cli/koji_cli/commands.py +++ b/cli/koji_cli/commands.py @@ -3013,7 +3013,10 @@ def anon_handle_list_channels(goptions, session, args): channels = sorted([x for x in session.listChannels(**opts)], key=lambda x: x['name']) except koji.ParameterError: channels = sorted([x for x in session.listChannels()], key=lambda x: x['name']) - first_item = channels[0] + if len(channels) > 0: + first_item = channels[0] + else: + first_item = {} session.multicall = True for channel in channels: session.listHosts(channelID=channel['id']) From 9740c1afd78a10688efdf487f49c78f18e79acb0 Mon Sep 17 00:00:00 2001 From: Jana Cupova Date: Sep 03 2021 12:48:56 +0000 Subject: [PATCH 2/2] Fix list-hosts with show-channels shows * with disabled channels --- diff --git a/cli/koji_cli/commands.py b/cli/koji_cli/commands.py index 0edbac4..b53f99e 100644 --- a/cli/koji_cli/commands.py +++ b/cli/koji_cli/commands.py @@ -3140,7 +3140,7 @@ def anon_handle_list_hosts(goptions, session, args): if options.show_channels: with session.multicall() as m: result = [m.listChannels(host['id']) for host in hosts] - first_line_channel = result[0].result + first_line_channel = result[0].result[0] for host, channels in zip(hosts, result): list_channels = [] for c in channels.result: