summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2014-09-10 08:44:46 +0000
committerGerrit Code Review <review@openstack.org>2014-09-10 08:44:46 +0000
commit703b5fc37d8901b550c1415da8b88c5e34fe6511 (patch)
treeb6c4b5f48648f103a52083f36c2178e452629ff8
parenta9367009ad3ab1da003bb5e43d1ae1e3ecfee2a3 (diff)
parent0a2e729e2939c905e0cb8dbfafa1e4a248606468 (diff)
downloadpython-keystoneclient-703b5fc37d8901b550c1415da8b88c5e34fe6511.tar.gz
Merge "Distinguish between name not provided and incorrect"
-rw-r--r--keystoneclient/auth/conf.py5
-rw-r--r--keystoneclient/tests/auth/test_conf.py6
2 files changed, 4 insertions, 7 deletions
diff --git a/keystoneclient/auth/conf.py b/keystoneclient/auth/conf.py
index c3d13db..ca14499 100644
--- a/keystoneclient/auth/conf.py
+++ b/keystoneclient/auth/conf.py
@@ -13,7 +13,6 @@
from oslo.config import cfg
from keystoneclient.auth import base
-from keystoneclient import exceptions
_AUTH_PLUGIN_OPT = cfg.StrOpt('auth_plugin', help='Name of the plugin to load')
@@ -89,7 +88,7 @@ def load_from_conf_options(conf, group, **kwargs):
:param conf: An oslo.config conf object.
:param string group: The group name that options should be read from.
- :returns plugin: An authentication Plugin.
+ :returns plugin: An authentication Plugin or None if a name is not provided
:raises exceptions.NoMatchingPlugin: if a plugin cannot be created.
"""
@@ -101,7 +100,7 @@ def load_from_conf_options(conf, group, **kwargs):
name = conf[group].auth_plugin
if not name:
- raise exceptions.NoMatchingPlugin('No plugin name provided for config')
+ return None
plugin_class = base.get_plugin_class(name)
plugin_class.register_conf_options(conf, group)
diff --git a/keystoneclient/tests/auth/test_conf.py b/keystoneclient/tests/auth/test_conf.py
index 24b2019..342333f 100644
--- a/keystoneclient/tests/auth/test_conf.py
+++ b/keystoneclient/tests/auth/test_conf.py
@@ -101,10 +101,8 @@ class ConfTests(utils.TestCase):
self.GROUP)
def test_loading_with_no_data(self):
- self.assertRaises(exceptions.NoMatchingPlugin,
- conf.load_from_conf_options,
- self.conf_fixture.conf,
- self.GROUP)
+ self.assertIsNone(conf.load_from_conf_options(self.conf_fixture.conf,
+ self.GROUP))
@mock.patch('stevedore.DriverManager')
def test_other_params(self, m):