Add --enabled --ready filters for list-channels

Fixes: https://pagure.io/koji/issue/939
This commit is contained in:
Tomas Kopecek 2018-05-22 11:03:35 +02:00 committed by Mike McLean
parent 524ce54340
commit 77237cb9c4

View file

@ -2708,12 +2708,16 @@ def anon_handle_list_channels(goptions, session, args):
parser = OptionParser(usage=usage)
parser.add_option("--quiet", action="store_true", default=goptions.quiet,
help=_("Do not print header information"))
parser.add_option("--ready", action="store_true",
help=_("List only ready builders"))
parser.add_option("--enabled", action="store_true",
help=_("List only enabled builders"))
(options, args) = parser.parse_args(args)
activate_session(session, goptions)
channels = session.listChannels()
session.multicall = True
for channel in channels:
session.listHosts(channelID=channel['id'])
session.listHosts(channelID=channel['id'], ready=options.ready, enabled=options.enabled)
for channel, hosts in zip(channels, session.multiCall()):
channel['hosts'] = len(hosts[0])
if not options.quiet: