mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Merge pull request #16342 from whiteinge/wildcard-eauth-check
Removed duplicate eauth name checks
This commit is contained in:
commit
e41c5c2f52
@ -982,13 +982,10 @@ class LocalFuncs(object):
|
||||
log.warning(msg)
|
||||
return dict(error=dict(name='TokenAuthenticationError',
|
||||
message=msg))
|
||||
if token['name'] not in self.opts['external_auth'][token['eauth']]:
|
||||
msg = 'Authentication failure of type "token" occurred.'
|
||||
log.warning(msg)
|
||||
return dict(error=dict(name='TokenAuthenticationError',
|
||||
message=msg))
|
||||
good = self.ckminions.runner_check(
|
||||
self.opts['external_auth'][token['eauth']][token['name']] if token['name'] in self.opts['external_auth'][token['eauth']] else self.opts['external_auth'][token['eauth']]['*'],
|
||||
self.opts['external_auth'][token['eauth']][token['name']]
|
||||
if token['name'] in self.opts['external_auth'][token['eauth']]
|
||||
else self.opts['external_auth'][token['eauth']]['*'],
|
||||
load['fun'])
|
||||
if not good:
|
||||
msg = ('Authentication failure of type "token" occurred for '
|
||||
@ -1094,15 +1091,10 @@ class LocalFuncs(object):
|
||||
log.warning(msg)
|
||||
return dict(error=dict(name='TokenAuthenticationError',
|
||||
message=msg))
|
||||
if token['name'] not in self.opts['external_auth'][token['eauth']]:
|
||||
msg = 'Authentication failure of type "token" occurred.'
|
||||
log.warning(msg)
|
||||
return dict(error=dict(name='TokenAuthenticationError',
|
||||
message=msg))
|
||||
good = self.ckminions.wheel_check(
|
||||
self.opts['external_auth'][token['eauth']][token['name']]
|
||||
if token['name'] in self.opts['external_auth'][token['eauth']]
|
||||
else self.opts['external_auth'][token['eauth']]['*'],
|
||||
if token['name'] in self.opts['external_auth'][token['eauth']]
|
||||
else self.opts['external_auth'][token['eauth']]['*'],
|
||||
load['fun'])
|
||||
if not good:
|
||||
msg = ('Authentication failure of type "token" occurred for '
|
||||
|
@ -1728,13 +1728,11 @@ class ClearFuncs(object):
|
||||
log.warning(msg)
|
||||
return dict(error=dict(name='TokenAuthenticationError',
|
||||
message=msg))
|
||||
if token['name'] not in self.opts['external_auth'][token['eauth']]:
|
||||
msg = 'Authentication failure of type "token" occurred.'
|
||||
log.warning(msg)
|
||||
return dict(error=dict(name='TokenAuthenticationError',
|
||||
message=msg))
|
||||
|
||||
good = self.ckminions.runner_check(
|
||||
self.opts['external_auth'][token['eauth']][token['name']] if token['name'] in self.opts['external_auth'][token['eauth']] else self.opts['external_auth'][token['eauth']]['*'],
|
||||
self.opts['external_auth'][token['eauth']][token['name']]
|
||||
if token['name'] in self.opts['external_auth'][token['eauth']]
|
||||
else self.opts['external_auth'][token['eauth']]['*'],
|
||||
clear_load['fun'])
|
||||
if not good:
|
||||
msg = ('Authentication failure of type "token" occurred for '
|
||||
@ -1786,7 +1784,9 @@ class ClearFuncs(object):
|
||||
return dict(error=dict(name='EauthAuthenticationError',
|
||||
message=msg))
|
||||
good = self.ckminions.runner_check(
|
||||
self.opts['external_auth'][clear_load['eauth']][name] if name in self.opts['external_auth'][clear_load['eauth']] else self.opts['external_auth'][clear_load['eauth']]['*'],
|
||||
self.opts['external_auth'][clear_load['eauth']][name]
|
||||
if name in self.opts['external_auth'][clear_load['eauth']]
|
||||
else self.opts['external_auth'][clear_load['eauth']]['*'],
|
||||
clear_load['fun'])
|
||||
if not good:
|
||||
msg = ('Authentication failure of type "eauth" occurred for '
|
||||
@ -1840,11 +1840,6 @@ class ClearFuncs(object):
|
||||
log.warning(msg)
|
||||
return dict(error=dict(name='TokenAuthenticationError',
|
||||
message=msg))
|
||||
if token['name'] not in self.opts['external_auth'][token['eauth']]:
|
||||
msg = 'Authentication failure of type "token" occurred.'
|
||||
log.warning(msg)
|
||||
return dict(error=dict(name='TokenAuthenticationError',
|
||||
message=msg))
|
||||
good = self.ckminions.wheel_check(
|
||||
self.opts['external_auth'][token['eauth']][token['name']]
|
||||
if token['name'] in self.opts['external_auth'][token['eauth']]
|
||||
|
@ -40,6 +40,10 @@ external_auth:
|
||||
- '@wheel'
|
||||
- '@runner'
|
||||
- test.*
|
||||
'*':
|
||||
- '@wheel'
|
||||
- '@runner'
|
||||
- test.*
|
||||
|
||||
master_tops:
|
||||
master_tops_test: True
|
||||
|
@ -89,6 +89,16 @@ class RunnerModuleTest(integration.ClientCase):
|
||||
self.assertEqual(ret['kwargs']['foo'], 'Foo!')
|
||||
self.assertEqual(ret['kwargs']['bar'], 'Bar!')
|
||||
|
||||
def test_wildcard_auth(self):
|
||||
low = {
|
||||
'username': 'the_s0und_of_t3ch',
|
||||
'password': 'willrockyou',
|
||||
'eauth': 'auto',
|
||||
'fun': 'test.arg',
|
||||
'foo': 'Foo!',
|
||||
'bar': 'Bar!',
|
||||
}
|
||||
self.runner.cmd_sync(low)
|
||||
|
||||
if __name__ == '__main__':
|
||||
from integration import run_tests
|
||||
|
@ -57,6 +57,16 @@ class WheelModuleTest(integration.ClientCase):
|
||||
'token': token['token'],
|
||||
})
|
||||
|
||||
def test_wildcard_auth(self):
|
||||
low = {
|
||||
'username': 'the_s0und_of_t3ch',
|
||||
'password': 'willrockyou',
|
||||
'eauth': 'auto',
|
||||
'fun': 'key.list_all',
|
||||
}
|
||||
|
||||
self.wheel.cmd_sync(low)
|
||||
|
||||
if __name__ == '__main__':
|
||||
from integration import run_tests
|
||||
run_tests(WheelModuleTest, needs_daemon=True)
|
||||
|
Loading…
Reference in New Issue
Block a user