summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-02-09 05:17:12 +0000
committerGerrit Code Review <review@openstack.org>2015-02-09 05:17:12 +0000
commit6106b2be8393e6cb4256b5a2916f065e67e673f9 (patch)
tree66079d69bac1bcff4d6225fe723c3c373d50a82c
parenta69a1d0d749d62098fe6c1c59e1c45b34960b800 (diff)
parentc57e562d2b941c47abdfea46fbe45e8f8cdf431b (diff)
downloadpython-keystoneclient-6106b2be8393e6cb4256b5a2916f065e67e673f9.tar.gz
Merge "Add name parameter to NoMatchingPlugin exception"
-rw-r--r--keystoneclient/auth/base.py4
-rw-r--r--keystoneclient/exceptions.py11
-rw-r--r--keystoneclient/tests/auth/test_conf.py13
3 files changed, 20 insertions, 8 deletions
diff --git a/keystoneclient/auth/base.py b/keystoneclient/auth/base.py
index 9da90b7..5b622e7 100644
--- a/keystoneclient/auth/base.py
+++ b/keystoneclient/auth/base.py
@@ -17,7 +17,6 @@ import six
import stevedore
from keystoneclient import exceptions
-from keystoneclient.i18n import _
# NOTE(jamielennox): The AUTH_INTERFACE is a special value that can be
@@ -44,8 +43,7 @@ def get_plugin_class(name):
name=name,
invoke_on_load=False)
except RuntimeError:
- msg = _('The plugin %s could not be found') % name
- raise exceptions.NoMatchingPlugin(msg)
+ raise exceptions.NoMatchingPlugin(name)
return mgr.driver
diff --git a/keystoneclient/exceptions.py b/keystoneclient/exceptions.py
index 241d27b..a76aa32 100644
--- a/keystoneclient/exceptions.py
+++ b/keystoneclient/exceptions.py
@@ -81,8 +81,19 @@ class MissingAuthPlugin(ClientException):
class NoMatchingPlugin(ClientException):
"""There were no auth plugins that could be created from the parameters
provided.
+
+ :param str name: The name of the plugin that was attempted to load.
+
+ .. py:attribute:: name
+
+ The name of the plugin that was attempted to load.
"""
+ def __init__(self, name):
+ self.name = name
+ msg = _('The plugin %s could not be found') % name
+ super(NoMatchingPlugin, self).__init__(msg)
+
class InvalidResponse(ClientException):
"""The response from the server is not valid for this request."""
diff --git a/keystoneclient/tests/auth/test_conf.py b/keystoneclient/tests/auth/test_conf.py
index 342333f..4945b3f 100644
--- a/keystoneclient/tests/auth/test_conf.py
+++ b/keystoneclient/tests/auth/test_conf.py
@@ -92,13 +92,16 @@ class ConfTests(utils.TestCase):
self.assertEqual(project_domain_name, a.project_domain_name)
def test_loading_invalid_plugin(self):
- self.conf_fixture.config(auth_plugin=uuid.uuid4().hex,
+ auth_plugin = uuid.uuid4().hex
+ self.conf_fixture.config(auth_plugin=auth_plugin,
group=self.GROUP)
- self.assertRaises(exceptions.NoMatchingPlugin,
- conf.load_from_conf_options,
- self.conf_fixture.conf,
- self.GROUP)
+ e = self.assertRaises(exceptions.NoMatchingPlugin,
+ conf.load_from_conf_options,
+ self.conf_fixture.conf,
+ self.GROUP)
+
+ self.assertEqual(auth_plugin, e.name)
def test_loading_with_no_data(self):
self.assertIsNone(conf.load_from_conf_options(self.conf_fixture.conf,