From 87dc53e64c26cd818b58f950c1ffeb76fbbe16ae Mon Sep 17 00:00:00 2001 From: Chenxiong Qi Date: Oct 15 2018 12:26:27 +0000 Subject: Ignore non-existing option when activate a session For kerberos auth, if not login with a keytab and principal, those two options may not be present in the incoming options. Similarly, debug is also an optional option that could not exist. Signed-off-by: Chenxiong Qi --- diff --git a/cli/koji_cli/lib.py b/cli/koji_cli/lib.py index f4bce0f..162d6a1 100644 --- a/cli/koji_cli/lib.py +++ b/cli/koji_cli/lib.py @@ -578,7 +578,7 @@ def activate_session(session, options): session.login() elif options.authtype == "kerberos" or has_krb_creds() and options.authtype is None: try: - if options.keytab and options.principal: + if getattr(options, 'keytab', None) and getattr(options, 'principal', None): session.krb_login(principal=options.principal, keytab=options.keytab, proxyuser=runas) else: session.krb_login(proxyuser=runas) @@ -592,7 +592,7 @@ def activate_session(session, options): if not noauth and not session.logged_in: error(_("Unable to log in, no authentication methods available")) ensure_connection(session) - if options.debug: + if getattr(options, 'debug', None): print("successfully connected to hub")