You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aurora.apache.org by mc...@apache.org on 2014/03/21 15:45:58 UTC
git commit: Catch errors thrown by authentication modules.
Repository: incubator-aurora
Updated Branches:
refs/heads/master d021e7956 -> b01dbaa92
Catch errors thrown by authentication modules.
Authentication modules can throw arbitrary errors - ldap exceptions,
password errors, etc, if auth fails with one of these app specific
errors, the client current dumps its cookies in a stack dump. This
change catches the error cleanly, and transforms it into a handled
authentication exception.
Bugs closed: aurora-259
Reviewed at https://reviews.apache.org/r/19143/
Project: http://git-wip-us.apache.org/repos/asf/incubator-aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-aurora/commit/b01dbaa9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-aurora/tree/b01dbaa9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-aurora/diff/b01dbaa9
Branch: refs/heads/master
Commit: b01dbaa92741976f85ce2446d2983f63df1009b6
Parents: d021e79
Author: Mark Chu-Carroll <mc...@twopensource.com>
Authored: Fri Mar 21 10:32:31 2014 -0400
Committer: Mark Chu-Carroll <mc...@twitter.com>
Committed: Fri Mar 21 10:32:31 2014 -0400
----------------------------------------------------------------------
src/main/python/apache/aurora/client/api/scheduler_client.py | 8 ++++++++
1 file changed, 8 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/b01dbaa9/src/main/python/apache/aurora/client/api/scheduler_client.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/api/scheduler_client.py b/src/main/python/apache/aurora/client/api/scheduler_client.py
index f770df7..d0e0821 100644
--- a/src/main/python/apache/aurora/client/api/scheduler_client.py
+++ b/src/main/python/apache/aurora/client/api/scheduler_client.py
@@ -17,6 +17,7 @@
import functools
import threading
import time
+import traceback
from apache.aurora.common.auth import make_session_key, SessionKeyError
from apache.aurora.common.cluster import Cluster
@@ -238,10 +239,17 @@ class SchedulerProxy(object):
start = time.time()
while (time.time() - start) < self.CONNECT_MAXIMUM_WAIT.as_(Time.SECONDS):
try:
+ # this can wind up generating any kind of error, because it turns into
+ # a call to a dynamically set authentication module.
self._client = self._scheduler_client.get_thrift_client()
break
except SchedulerClient.CouldNotConnect as e:
log.warning('Could not connect to scheduler: %s' % e)
+ except Exception as e:
+ # turn any auth module exception into an auth error.
+ log.debug('Warning: got an unknown exception during authentication:')
+ log.debug(traceback.format_exc())
+ raise self.AuthenticationError('Error connecting to scheduler: %s' % e)
if not self._client:
raise self.TimeoutError('Timed out trying to connect to scheduler at %s' % self.cluster.name)