simplify check for krbV module
This commit is contained in:
parent
cc208eff5d
commit
4c07073403
4 changed files with 4 additions and 4 deletions
|
|
@ -5782,7 +5782,7 @@ if __name__ == "__main__":
|
|||
quit("Error: Unable to log in. Bad credentials?")
|
||||
except xmlrpclib.ProtocolError:
|
||||
quit("Error: Unable to connect to server %s" % (options.server))
|
||||
elif krbV and 'krbV' in sys.modules:
|
||||
elif krbV:
|
||||
krb_principal = options.krb_principal
|
||||
if krb_principal is None:
|
||||
krb_principal = options.host_principal_format % socket.getfqdn()
|
||||
|
|
|
|||
|
|
@ -345,7 +345,7 @@ def ensure_connection(session):
|
|||
warn(_("WARNING: The server is at API version %d and the client is at %d" % (ret, koji.API_VERSION)))
|
||||
|
||||
def has_krb_creds():
|
||||
if krbV is None or 'krbV' not in sys.modules:
|
||||
if krbV is None:
|
||||
return False
|
||||
try:
|
||||
ctx = krbV.default_context()
|
||||
|
|
|
|||
|
|
@ -320,7 +320,7 @@ def activate_session(session):
|
|||
elif options.user:
|
||||
#authenticate using user/password
|
||||
session.login()
|
||||
elif krbV and 'krbV' in sys.modules:
|
||||
elif krbV:
|
||||
try:
|
||||
if options.keytab and options.principal:
|
||||
session.krb_login(principal=options.principal, keytab=options.keytab, proxyuser=options.runas)
|
||||
|
|
|
|||
|
|
@ -1099,7 +1099,7 @@ if __name__ == "__main__":
|
|||
quit("Error: Unable to log in. Bad credentials?")
|
||||
except xmlrpclib.ProtocolError:
|
||||
quit("Error: Unable to connect to server %s" % (options.server))
|
||||
elif krbV and 'krbV' in sys.modules:
|
||||
elif krbV:
|
||||
krb_principal = options.krb_principal
|
||||
if krb_principal is None:
|
||||
krb_principal = options.host_principal_format % socket.getfqdn()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue