Change default endpoint for Keystone v3 to public

All of the other Openstack services have a 'public' default endpoint
type. Keystone has 'admin' default endpoint type. Why not make
Keystone compliant and change the default for Keystone v3 from 'admin'
to 'public'. Keystone v2 will remain the same with an 'admin' default.

Closes-Bug: #1457702
Change-Id: I515438477dba72c2a0c4595603000690511b5700
This commit is contained in:
Roxana Gherle 2015-08-20 10:35:29 -07:00 committed by Boris Bobrov
parent 8506a6e071
commit d3b11d674d
4 changed files with 19 additions and 3 deletions

View File

@ -232,7 +232,7 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
self.stub_auth(json=self.TEST_RESPONSE_DICT)
self.stub_url('GET', [fake_url], json=fake_resp,
base_url=self.TEST_ADMIN_IDENTITY_ENDPOINT)
base_url=self.TEST_PUBLIC_IDENTITY_ENDPOINT)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
@ -336,7 +336,7 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
self.stub_auth(json=self.TEST_RESPONSE_DICT)
self.stub_url('GET', [fake_url], json=fake_resp,
base_url=self.TEST_ADMIN_IDENTITY_ENDPOINT)
base_url=self.TEST_PUBLIC_IDENTITY_ENDPOINT)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():

View File

@ -257,3 +257,13 @@ class KeystoneClientTest(utils.TestCase):
self.assertEqual('identity', cl._adapter.service_type)
self.assertEqual((3, 0), cl._adapter.version)
def test_client_params_default_interface(self):
opts = {'auth': token_endpoint.Token('a', 'b'),
'service_name': uuid.uuid4().hex,
}
sess = session.Session()
cl = client.Client(session=sess, **opts)
self.assertEqual('public', cl._adapter.interface)

View File

@ -48,6 +48,7 @@ class UnauthenticatedTestCase(utils.TestCase):
class TestCase(UnauthenticatedTestCase):
TEST_ADMIN_IDENTITY_ENDPOINT = "http://127.0.0.1:35357/v3"
TEST_PUBLIC_IDENTITY_ENDPOINT = "http://127.0.0.1:5000/v3"
TEST_SERVICE_CATALOG = [{
"endpoints": [{
@ -97,7 +98,7 @@ class TestCase(UnauthenticatedTestCase):
"name": "glance"
}, {
"endpoints": [{
"url": "http://127.0.0.1:5000/v3",
"url": TEST_PUBLIC_IDENTITY_ENDPOINT,
"region": "RegionOne",
"interface": "public"
}, {

View File

@ -187,6 +187,11 @@ EndpointPolicyManager`
def __init__(self, **kwargs):
"""Initialize a new client for the Keystone v3 API."""
# NOTE(Roxana Gherle): Keystone V3 APIs has no admin versus public
# distinction. They are both going through the same endpoint, so
# set a public default here instead of picking up an admin default in
# httpclient.HTTPClient
kwargs.setdefault('interface', 'public')
super(Client, self).__init__(**kwargs)
if not kwargs.get('session'):