show hub version in koji hello
This commit is contained in:
parent
8e6737a116
commit
cfd6d3064f
3 changed files with 7 additions and 4 deletions
|
|
@ -7565,7 +7565,7 @@ def handle_moshimoshi(options, session, args):
|
||||||
u = {'name': 'anonymous user'}
|
u = {'name': 'anonymous user'}
|
||||||
print("%s, %s!" % (_printable_unicode(random.choice(greetings)), u["name"]))
|
print("%s, %s!" % (_printable_unicode(random.choice(greetings)), u["name"]))
|
||||||
print("")
|
print("")
|
||||||
print("You are using the hub at %s" % session.baseurl)
|
print("You are using the hub at %s (Koji %s)" % (session.baseurl, session.hub_version_str))
|
||||||
authtype = u.get('authtype', getattr(session, 'authtype', None))
|
authtype = u.get('authtype', getattr(session, 'authtype', None))
|
||||||
if authtype == koji.AUTHTYPES['NORMAL']:
|
if authtype == koji.AUTHTYPES['NORMAL']:
|
||||||
print("Authenticated via password")
|
print("Authenticated via password")
|
||||||
|
|
|
||||||
|
|
@ -2643,7 +2643,8 @@ class ClientSession(object):
|
||||||
self.__hub_version = self.getKojiVersion()
|
self.__hub_version = self.getKojiVersion()
|
||||||
except GenericError as e:
|
except GenericError as e:
|
||||||
if 'Invalid method' in str(e):
|
if 'Invalid method' in str(e):
|
||||||
# hub is older than 1.23, return latest version without the getKojiVersion
|
# use latest version without the getKojiVersion handler
|
||||||
|
self.logger.debug("hub is older than 1.23, assuming 1.22.0")
|
||||||
self.__hub_version = '1.22.0'
|
self.__hub_version = '1.22.0'
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,8 @@ class TestHello(utils.CliTestCase):
|
||||||
# Mock out the xmlrpc server
|
# Mock out the xmlrpc server
|
||||||
session.getLoggedInUser.return_value = None
|
session.getLoggedInUser.return_value = None
|
||||||
session.krb_principal = user['krb_principal']
|
session.krb_principal = user['krb_principal']
|
||||||
|
mock_hub_version = '1.35.0'
|
||||||
|
session.hub_version_str = mock_hub_version
|
||||||
print_unicode_mock.return_value = "Hello"
|
print_unicode_mock.return_value = "Hello"
|
||||||
|
|
||||||
self.assert_system_exit(
|
self.assert_system_exit(
|
||||||
|
|
@ -63,7 +65,7 @@ class TestHello(utils.CliTestCase):
|
||||||
|
|
||||||
# annonymous user
|
# annonymous user
|
||||||
message = "Not authenticated\n" + "Hello, anonymous user!"
|
message = "Not authenticated\n" + "Hello, anonymous user!"
|
||||||
hubinfo = "You are using the hub at %s" % self.huburl
|
hubinfo = "You are using the hub at %s (Koji %s)" % (self.huburl, mock_hub_version)
|
||||||
handle_moshimoshi(self.options, session, [])
|
handle_moshimoshi(self.options, session, [])
|
||||||
self.assert_console_message(stdout, "{0}\n\n{1}\n".format(message, hubinfo))
|
self.assert_console_message(stdout, "{0}\n\n{1}\n".format(message, hubinfo))
|
||||||
self.activate_session_mock.assert_called_once_with(session, self.options)
|
self.activate_session_mock.assert_called_once_with(session, self.options)
|
||||||
|
|
@ -79,7 +81,7 @@ class TestHello(utils.CliTestCase):
|
||||||
user['krb_principal'],
|
user['krb_principal'],
|
||||||
koji.AUTHTYPES['SSL']: 'Authenticated via client certificate %s' % cert
|
koji.AUTHTYPES['SSL']: 'Authenticated via client certificate %s' % cert
|
||||||
}
|
}
|
||||||
hubinfo = "You are using the hub at %s" % self.huburl
|
# same hubinfo
|
||||||
session.getLoggedInUser.return_value = user
|
session.getLoggedInUser.return_value = user
|
||||||
message = "Hello, %s!" % self.progname
|
message = "Hello, %s!" % self.progname
|
||||||
self.options.cert = cert
|
self.options.cert = cert
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue