Fix token_endpoint usage
Commit 22d740b7007e1182c99370cb2629322384b17a14 broke token_endpoint authentication for openstackclient, by unconditionally setting auth_type to 'token' whenever a token was passed in the command line. This change reverts the portion that always overrides the auth plugin if there is a token passed via arguments. Change-Id: I835c3716dd08eaca10f56682c22fdc6ac700e0fe
This commit is contained in:
parent
0280db8521
commit
77c0365ce2
@ -883,7 +883,6 @@ class OpenStackConfig(object):
|
||||
if (('auth' in config and 'token' in config['auth']) or
|
||||
('auth_token' in config and config['auth_token']) or
|
||||
('token' in config and config['token'])):
|
||||
config['auth_type'] = 'token'
|
||||
config.setdefault('token', config.pop('auth_token', None))
|
||||
|
||||
# These backwards compat values are only set via argparse. If it's
|
||||
|
@ -482,7 +482,8 @@ class TestConfigArgparse(base.TestCase):
|
||||
# novaclient will add this
|
||||
parser.add_argument('--os-auth-token')
|
||||
opts, _remain = parser.parse_known_args(
|
||||
['--os-auth-token', 'very-bad-things'])
|
||||
['--os-auth-token', 'very-bad-things',
|
||||
'--os-auth-type', 'token'])
|
||||
cc = c.get_one_cloud(argparse=opts)
|
||||
self.assertEqual(cc.config['auth_type'], 'token')
|
||||
self.assertEqual(cc.config['auth']['token'], 'very-bad-things')
|
||||
|
Loading…
x
Reference in New Issue
Block a user