Skip to content

Commit 94be780

Browse files
committed
[_518] preserve login_<auth-type> internally generated exceptions
1 parent a67fb1a commit 94be780

1 file changed

Lines changed: 17 additions & 11 deletions

File tree

irods/connection.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,31 +65,37 @@ def __init__(self, pool, account):
6565
self._disconnected = False
6666

6767
scheme = self.account._original_authentication_scheme
68-
auth_type = ''
68+
69+
# These variables are just useful diagnostics. The login_XYZ() methods should fail by
70+
# raising exceptions if they encounter authentication errors.
71+
auth_module = auth_type = ''
6972

7073
if self.server_version >= (4,3,0):
74+
auth_module = None
7175
# use client side "plugin" module: irods.auth.<scheme>
7276
irods.auth.load_plugins(subset=[scheme])
7377
auth_module = getattr(irods.auth, scheme, None)
78+
79+
# TODO (#518 unrelated): gsi module that also sets _client_ctx?
80+
7481
if auth_module:
7582
auth_module.login(self)
7683
auth_type = auth_module.__name__
7784
else:
7885
# use legacy (iRODS pre-4.3 style) authentication
7986
auth_type = scheme
80-
try:
81-
if scheme == NATIVE_AUTH_SCHEME:
82-
self._login_native()
83-
elif scheme == GSI_AUTH_SCHEME:
84-
self.client_ctx = None
85-
self._login_gsi()
86-
elif scheme == PAM_AUTH_SCHEME:
87-
self._login_pam()
88-
except:
87+
if scheme == NATIVE_AUTH_SCHEME:
88+
self._login_native()
89+
elif scheme == GSI_AUTH_SCHEME:
90+
self.client_ctx = None
91+
self._login_gsi()
92+
elif scheme == PAM_AUTH_SCHEME:
93+
self._login_pam()
94+
else:
8995
auth_type = None
9096

9197
if not auth_type:
92-
msg = "Authentication failed: scheme = {scheme!r}, auth_type = {auth_type!r}".format(**locals())
98+
msg = "Authentication failed: scheme = {scheme!r}, auth_type = {auth_type!r}, auth_module = {auth_module!r}, ".format(**locals())
9399
raise ValueError(msg)
94100

95101
self.create_time = datetime.datetime.now()

0 commit comments

Comments
 (0)