From 5c5e512991efa2e5e4423e3be588dd8dc00a33a2 Mon Sep 17 00:00:00 2001 From: TerryHowe Date: Wed, 15 Jul 2015 12:20:23 -0600 Subject: [PATCH] Change auth plugin names to match KSA The names of the plugins should match KSA and KSC. Change-Id: I2f8633523bd596904f8eeb818c216daa923ace64 --- openstack/connection.py | 2 +- openstack/module_loader.py | 2 +- openstack/tests/unit/test_connection.py | 6 +++--- openstack/tests/unit/test_module_loader.py | 14 +++++++------- setup.cfg | 11 ++++++----- 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/openstack/connection.py b/openstack/connection.py index 94538ba0..b8f6300d 100644 --- a/openstack/connection.py +++ b/openstack/connection.py @@ -113,7 +113,7 @@ class Connection(object): the authentication plugin name is not provided, the connection will try to guess what plugin to use based on the *auth_url* in the *auth_args*. Two common values for the plugin would be - ``identity_v2`` and ``identity_v3``. + ``v3password`` and ``v3token``. :param auth_args: The rest of the parameters provided are assumed to be authentication arguments that are used by the authentication plugin. diff --git a/openstack/module_loader.py b/openstack/module_loader.py index 12073d8f..b11f2c11 100644 --- a/openstack/module_loader.py +++ b/openstack/module_loader.py @@ -30,7 +30,7 @@ class ModuleLoader(object): def get_auth_plugin(self, plugin_name): """Get an authentication plugin by name.""" if not plugin_name: - plugin_name = 'identity' + plugin_name = 'password' try: return self.auth_mgr[plugin_name].plugin except KeyError: diff --git a/openstack/tests/unit/test_connection.py b/openstack/tests/unit/test_connection.py index 30a5f818..727fe344 100644 --- a/openstack/tests/unit/test_connection.py +++ b/openstack/tests/unit/test_connection.py @@ -45,7 +45,7 @@ class TestConnection(base.TestCase): 'password': '2', } conn = connection.Connection(transport='0', - auth_plugin='identity_v2_password', + auth_plugin='v2password', **auth_args) self.assertEqual('0', conn.authenticator.auth_url) self.assertEqual('1', conn.authenticator.username) @@ -58,7 +58,7 @@ class TestConnection(base.TestCase): 'password': '2', } conn = connection.Connection(transport='0', - auth_plugin='identity_v3_password', + auth_plugin='v3password', **auth_args) self.assertEqual('0', conn.authenticator.auth_url) self.assertEqual('1', conn.authenticator.auth_methods[0].username) @@ -70,7 +70,7 @@ class TestConnection(base.TestCase): 'username': '1', 'password': '2', } - conn = connection.Connection(transport='0', auth_plugin='identity', + conn = connection.Connection(transport='0', auth_plugin='password', **auth_args) self.assertEqual('0', conn.authenticator.auth_url) self.assertEqual( diff --git a/openstack/tests/unit/test_module_loader.py b/openstack/tests/unit/test_module_loader.py index c8726e58..71015152 100644 --- a/openstack/tests/unit/test_module_loader.py +++ b/openstack/tests/unit/test_module_loader.py @@ -18,20 +18,20 @@ from openstack.tests.unit import base class TestModuleLoader(base.TestCase): def test_load_identity_v2(self): loader = module_loader.ModuleLoader() - plugin = loader.get_auth_plugin('identity_v2_password') + plugin = loader.get_auth_plugin('v2password') self.assertEqual('openstack.auth.identity.v2', str(plugin.__module__)) - plugin = loader.get_auth_plugin('identity_v2_token') + plugin = loader.get_auth_plugin('v2token') self.assertEqual('openstack.auth.identity.v2', str(plugin.__module__)) def test_load_identity_v3(self): loader = module_loader.ModuleLoader() - plugin = loader.get_auth_plugin('identity_v3_password') + plugin = loader.get_auth_plugin('v3password') self.assertEqual('openstack.auth.identity.v3', str(plugin.__module__)) - plugin = loader.get_auth_plugin('identity_v3_token') + plugin = loader.get_auth_plugin('v3token') self.assertEqual('openstack.auth.identity.v3', str(plugin.__module__)) def test_load_identity_discoverable(self): - plugin = module_loader.ModuleLoader().get_auth_plugin('identity') + plugin = module_loader.ModuleLoader().get_auth_plugin('password') self.assertEqual('openstack.auth.identity.discoverable', str(plugin.__module__)) @@ -51,6 +51,6 @@ class TestModuleLoader(base.TestCase): def test_list_auth_plugins(self): plugins = sorted(module_loader.ModuleLoader().list_auth_plugins()) - expected = ['identity', 'identity_v2_password', 'identity_v2_token', - 'identity_v3_password', 'identity_v3_token'] + expected = ['password', 'token', 'v2password', 'v2token', + 'v3password', 'v3token'] self.assertEqual(expected, plugins) diff --git a/setup.cfg b/setup.cfg index 9f0fe01a..0e87f617 100644 --- a/setup.cfg +++ b/setup.cfg @@ -51,8 +51,9 @@ universal = 1 [entry_points] openstack.auth.plugin = - identity_v2_password = openstack.auth.identity.v2:Password - identity_v2_token = openstack.auth.identity.v2:Token - identity_v3_password = openstack.auth.identity.v3:Password - identity_v3_token = openstack.auth.identity.v3:Token - identity = openstack.auth.identity.discoverable:Auth + v2password = openstack.auth.identity.v2:Password + v2token = openstack.auth.identity.v2:Token + v3password = openstack.auth.identity.v3:Password + v3token = openstack.auth.identity.v3:Token + password = openstack.auth.identity.discoverable:Auth + token = openstack.auth.identity.discoverable:Auth