Use keystone session in endpoint_utils
Change-Id: I404f3c85ed97462f5628da3bdeb2bad0ae930012
This commit is contained in:
parent
313e47f47a
commit
1fb685918b
|
@ -13,7 +13,8 @@
|
|||
#
|
||||
# Copyright 2015 IBM Corp.
|
||||
|
||||
from keystoneclient import discover as ks_discover
|
||||
from keystoneauth1 import discover as ks_discover
|
||||
from keystoneauth1 import session as ks_session
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import importutils
|
||||
|
||||
|
@ -25,12 +26,10 @@ def get_auth_uri(v3=True):
|
|||
# check the [clients_keystone] section, and if it is not set we
|
||||
# look in [keystone_authtoken]
|
||||
if cfg.CONF.clients_keystone.auth_uri:
|
||||
session = ks_session.Session(**config.get_ssl_options('keystone'))
|
||||
discover = ks_discover.Discover(
|
||||
auth_url=cfg.CONF.clients_keystone.auth_uri,
|
||||
cacert=config.get_client_option('keystone', 'ca_file'),
|
||||
insecure=config.get_client_option('keystone', 'insecure'),
|
||||
cert=config.get_client_option('keystone', 'cert_file'),
|
||||
key=config.get_client_option('keystone', 'key_file'))
|
||||
session=session,
|
||||
url=cfg.CONF.clients_keystone.auth_uri)
|
||||
return discover.url_for('3.0')
|
||||
else:
|
||||
# Import auth_token to have keystone_authtoken settings setup.
|
||||
|
|
|
@ -47,7 +47,7 @@ class AuthUrlFilterTest(common.HeatTestCase):
|
|||
mock_cfg.clients_keystone.auth_uri = 'foobar'
|
||||
mock_cfg.keystone_authtoken.auth_uri = 'this-should-be-ignored'
|
||||
mock_cfg.auth_password.multi_cloud = False
|
||||
with mock.patch('keystoneclient.discover.Discover') as discover:
|
||||
with mock.patch('keystoneauth1.discover.Discover') as discover:
|
||||
class MockDiscover(object):
|
||||
def url_for(self, endpoint):
|
||||
return 'foobar/v3'
|
||||
|
|
|
@ -150,7 +150,7 @@ class TestRequestContext(common.HeatTestCase):
|
|||
policy_check = 'heat.common.policy.Enforcer.check_is_admin'
|
||||
with mock.patch(policy_check) as pc:
|
||||
pc.return_value = False
|
||||
with mock.patch('keystoneclient.discover.Discover') as discover:
|
||||
with mock.patch('keystoneauth1.discover.Discover') as discover:
|
||||
class MockDiscover(object):
|
||||
def url_for(self, endpoint):
|
||||
return 'http://xyz/v3'
|
||||
|
|
Loading…
Reference in New Issue