Browse Source

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
tags/2.1.0
Roxana Gherle 5 years ago
committed by Boris Bobrov
parent
commit
d3b11d674d
4 changed files with 19 additions and 3 deletions
  1. +2
    -2
      keystoneclient/tests/unit/v3/test_auth.py
  2. +10
    -0
      keystoneclient/tests/unit/v3/test_client.py
  3. +2
    -1
      keystoneclient/tests/unit/v3/utils.py
  4. +5
    -0
      keystoneclient/v3/client.py

+ 2
- 2
keystoneclient/tests/unit/v3/test_auth.py 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():


+ 10
- 0
keystoneclient/tests/unit/v3/test_client.py 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)

+ 2
- 1
keystoneclient/tests/unit/v3/utils.py 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"
}, {


+ 5
- 0
keystoneclient/v3/client.py 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'):


Loading…
Cancel
Save