From 5a3246f22ad11ca52b955de33ce8a01b0529481f Mon Sep 17 00:00:00 2001 From: Chenxiong Qi Date: Mon, 15 Oct 2018 20:25:34 +0800 Subject: [PATCH] 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 --- cli/koji_cli/lib.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/koji_cli/lib.py b/cli/koji_cli/lib.py index f4bce0fb..162d6a19 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")