report versions of components

Fixes: https://pagure.io/koji/issue/2430
This commit is contained in:
Tomas Kopecek 2020-08-17 16:45:29 +02:00
parent 729f84767c
commit ba908fd2de
13 changed files with 70 additions and 21 deletions

View file

@ -2843,6 +2843,7 @@ def anon_handle_list_hosts(goptions, session, args):
parser.add_option("--quiet", action="store_true", default=goptions.quiet,
help=_("Do not print header information"))
parser.add_option("--show-channels", action="store_true", help=_("Show host's channels"))
parser.add_option("--show-version", action="store_true", help=_("Show host's' version"))
(options, args) = parser.parse_args(args)
opts = {}
ensure_connection(session)
@ -2896,14 +2897,24 @@ def anon_handle_list_hosts(goptions, session, args):
if not options.quiet:
hdr = "{hostname:<{longest_host}} Enb Rdy Load/Cap Arches Last Update".format(
longest_host=longest_host, hostname='Hostname')
if options.show_version:
hdr += " Version"
if options.show_channels:
hdr += " Channels"
hdr += " Channels"
print(hdr)
mask = "%%(name)-%ss %%(enabled)-3s %%(ready)-3s %%(task_load)4.1f/%%(capacity)-4.1f " \
"%%(arches)-16s %%(update)-19s" % longest_host
if options.show_version:
mask += " %(version)-10s"
if options.show_channels:
mask += " %(channels)s"
for host in hosts:
if host.get('version') is None:
# hub doesn't support it, so we don't know the version
host['version'] = 'not supported'
elif not host.get('version'):
# hub supports it, but builder doesn't report
host['version'] = '-'
print(mask % host)
@ -3330,6 +3341,7 @@ def anon_handle_hostinfo(goptions, session, args):
print("%s%s" % (" " * 9, line))
else:
print("Comment:")
print('Version: %s' % info['version'])
print("Enabled: %s" % (info['enabled'] and 'yes' or 'no'))
print("Ready: %s" % (info['ready'] and 'yes' or 'no'))
update = session.getLastHostUpdate(info['id'])
@ -7654,3 +7666,10 @@ def handle_unblock_notification(goptions, session, args):
session.deleteNotificationBlock(n_id)
if not goptions.quiet:
print(_("Notification block %d successfully removed.") % n_id)
def handle_version(goptions, session, args):
"""Report client and hub versions"""
ensure_connection(session)
print('Client: %s' % koji.__version__)
print('Hub: %s' % session.getKojiVersion())