Avoid failing at import time if krbV module is missing

Several parts of Koji already handled this absence gracefully. This change
extends that behavior to all places where krbV is imported.
This commit is contained in:
Mike McLean 2017-11-17 11:20:00 +08:00
parent dad74a3a9e
commit 91b306e108
5 changed files with 15 additions and 9 deletions

View file

@ -24,7 +24,7 @@
try:
import krbV
except ImportError: # pragma: no cover
pass
krbV = None
import koji
import koji.plugin
import koji.util
@ -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' in sys.modules:
elif krbV and 'krbV' in sys.modules:
krb_principal = options.krb_principal
if krb_principal is None:
krb_principal = options.host_principal_format % socket.getfqdn()