Fix NoSuchOptError when referring to conf.neutron.auth_plugin

Backporting to Mitaka

We already replaced 'auth_plugin' with 'auth_type'[1], now an
oslo_config.cfg.NoSuchOptError will be threw up when referring to
conf.neutron.auth_plugin.

This commit replace the usage of conf.neutron.auth_plugin by
conf.neutron.auth_type.

[1]a56ed4218a

Change-Id: I0b72f278ba8e28508274079ff284042fb9ea3d64
Closes-Bug: #1574988
Closes-Bug: #1604428
(cherry picked from commit 2647f91ae9)
This commit is contained in:
Wenzhi Yu 2016-04-26 18:55:16 +08:00 committed by Ryan Selden
parent 98b38df57b
commit 32a9d01c80
2 changed files with 8 additions and 1 deletions

View File

@ -116,7 +116,7 @@ def _load_auth_plugin(conf):
if auth_plugin:
return auth_plugin
err_msg = _('Unknown auth plugin: %s') % conf.neutron.auth_plugin
err_msg = _('Unknown auth type: %s') % conf.neutron.auth_type
raise neutron_client_exc.Unauthorized(message=err_msg)

View File

@ -180,6 +180,13 @@ class TestNeutronClient(test.NoDBTestCase):
client1.list_networks(retrieve_all=False)
self.assertEqual('new_token2', client1.httpclient.auth.get_token(None))
@mock.patch.object(ks_loading, 'load_auth_from_conf_options')
def test_load_auth_plugin_failed(self, mock_load_from_conf):
mock_load_from_conf.return_value = None
from neutronclient.common import exceptions as neutron_client_exc
self.assertRaises(neutron_client_exc.Unauthorized,
neutronapi._load_auth_plugin, CONF)
class TestNeutronv2Base(test.TestCase):