Catch authentication exceptions on the master

This commit is contained in:
Thomas S Hatch 2012-10-30 15:14:05 -06:00
parent 7db30d090a
commit ca0904511f

View File

@ -1420,6 +1420,7 @@ class ClearFuncs(object):
if not clear_load['eauth'] in self.opts['external_auth']: if not clear_load['eauth'] in self.opts['external_auth']:
# The eauth system is not enabled, fail # The eauth system is not enabled, fail
return '' return ''
try:
name = self.loadauth.load_name(clear_load) name = self.loadauth.load_name(clear_load)
if not name in self.opts['external_auth'][clear_load['eauth']]: if not name in self.opts['external_auth'][clear_load['eauth']]:
return '' return ''
@ -1433,6 +1434,12 @@ class ClearFuncs(object):
return self.wheel_.call_func( return self.wheel_.call_func(
clear_load.pop('fun'), clear_load.pop('fun'),
**clear_load) **clear_load)
except Exception as exc:
log.error(
('Exception occured in the wheel system: {0}'
).format(exc)
)
return ''
def mk_token(self, clear_load): def mk_token(self, clear_load):
''' '''
@ -1444,12 +1451,19 @@ class ClearFuncs(object):
if not clear_load['eauth'] in self.opts['external_auth']: if not clear_load['eauth'] in self.opts['external_auth']:
# The eauth system is not enabled, fail # The eauth system is not enabled, fail
return '' return ''
try:
name = self.loadauth.load_name(clear_load) name = self.loadauth.load_name(clear_load)
if not name in self.opts['external_auth'][clear_load['eauth']]: if not name in self.opts['external_auth'][clear_load['eauth']]:
return '' return ''
if not self.loadauth.time_auth(clear_load): if not self.loadauth.time_auth(clear_load):
return '' return ''
return self.loadauth.mk_token(clear_load) return self.loadauth.mk_token(clear_load)
except Exception as exc:
log.error(
('Exception occured while authenticating: {0}'
).format(exc)
)
return ''
def publish(self, clear_load): def publish(self, clear_load):
''' '''
@ -1460,7 +1474,14 @@ class ClearFuncs(object):
# Check for external auth calls # Check for external auth calls
if extra.get('token', False): if extra.get('token', False):
# A token was passwd, check it # A token was passwd, check it
try:
token = self.loadauth.get_tok(extra['token']) token = self.loadauth.get_tok(extra['token'])
except Exception as exc:
log.error(
('Exception occured when generating auth token: {0}'
).format(exc)
)
return ''
if not token: if not token:
return '' return ''
if not token['eauth'] in self.opts['external_auth']: if not token['eauth'] in self.opts['external_auth']:
@ -1480,11 +1501,18 @@ class ClearFuncs(object):
if not extra['eauth'] in self.opts['external_auth']: if not extra['eauth'] in self.opts['external_auth']:
# The eauth system is not enabled, fail # The eauth system is not enabled, fail
return '' return ''
try:
name = self.loadauth.load_name(extra) name = self.loadauth.load_name(extra)
if not name in self.opts['external_auth'][extra['eauth']]: if not name in self.opts['external_auth'][extra['eauth']]:
return '' return ''
if not self.loadauth.time_auth(extra): if not self.loadauth.time_auth(extra):
return '' return ''
except Exception:
log.error(
('Exception occured while authenticating: {0}'
).format(exc)
)
return ''
good = self.ckminions.auth_check( good = self.ckminions.auth_check(
self.opts['external_auth'][extra['eauth']][name], self.opts['external_auth'][extra['eauth']][name],
clear_load['fun'], clear_load['fun'],