Merge "Honor the common session options for the placement API"

This commit is contained in:
Jenkins 2017-06-30 12:20:10 +00:00 committed by Gerrit Code Review
commit b1dd13abfb
3 changed files with 8 additions and 4 deletions

View File

@ -62,7 +62,8 @@ common_config.register_nova_opts()
ks_loading.register_auth_conf_options(cfg.CONF,
common_config.PLACEMENT_CONF_SECTION)
ks_loading.register_session_conf_options(cfg.CONF,
common_config.PLACEMENT_CONF_SECTION)
# Register the placement configuration options
common_config.register_placement_opts()

View File

@ -17,7 +17,6 @@ import functools
from keystoneauth1 import exceptions as ks_exc
from keystoneauth1 import loading as ks_loading
from keystoneauth1 import session
from oslo_config import cfg
from neutron._i18n import _
@ -45,7 +44,8 @@ class PlacementAPIClient(object):
def __init__(self):
auth_plugin = ks_loading.load_auth_from_conf_options(
cfg.CONF, 'placement')
self._client = session.Session(auth=auth_plugin)
self._client = ks_loading.load_session_from_conf_options(
cfg.CONF, 'placement', auth=auth_plugin)
self._disabled = False
def _get(self, url, **kwargs):

View File

@ -2130,7 +2130,10 @@ class PlacementAPIClientTestCase(base.DietTestCase):
placement_client.PlacementAPIClient()
load_auth_mock.assert_called_once_with(cfg.CONF, 'placement')
ks_sess_mock.assert_called_once_with(auth=load_auth_mock.return_value)
ks_sess_mock.assert_called_once_with(auth=load_auth_mock.return_value,
cert=None,
timeout=None,
verify=True)
def test_create_resource_provider(self):
expected_payload = 'fake_resource_provider'