From 77c0365ce2d42adce9352cf238fbdbc7c282222f Mon Sep 17 00:00:00 2001 From: Javier Pena Date: Wed, 23 Dec 2015 11:38:40 +0100 Subject: 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 --- os_client_config/config.py | 1 - os_client_config/tests/test_config.py | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/os_client_config/config.py b/os_client_config/config.py index 89015cc..5101983 100644 --- a/os_client_config/config.py +++ b/os_client_config/config.py @@ -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 diff --git a/os_client_config/tests/test_config.py b/os_client_config/tests/test_config.py index 3ea6690..aef9737 100644 --- a/os_client_config/tests/test_config.py +++ b/os_client_config/tests/test_config.py @@ -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') -- cgit v1.2.1