summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Pena <jpena@redhat.com>2015-12-23 11:38:40 +0100
committerMorgan Fainberg <morgan.fainberg@gmail.com>2015-12-28 10:28:03 -0800
commit77c0365ce2d42adce9352cf238fbdbc7c282222f (patch)
tree7a68260b91fd80f846b4ed5f6f256f92a953e250
parent0280db852190db66607c6d48c321274d5e99f4d2 (diff)
downloados-client-config-77c0365ce2d42adce9352cf238fbdbc7c282222f.tar.gz
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
-rw-r--r--os_client_config/config.py1
-rw-r--r--os_client_config/tests/test_config.py3
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')