Add service_name to URL discovery
The catalog was recently enhanced to allow filtering based on the service_name so this should be passed on to endpoint filtering. Change-Id: If08fcdba9719f6aacdcbbb6b951117f4f544f9ca
This commit is contained in:
@@ -44,6 +44,7 @@ class BaseAuthPlugin(object):
|
|||||||
will be generated by the clients and should be used by plugins:
|
will be generated by the clients and should be used by plugins:
|
||||||
|
|
||||||
- ``service_type``: what sort of service is required.
|
- ``service_type``: what sort of service is required.
|
||||||
|
- ``service_name``: the name of the service in the catalog.
|
||||||
- ``interface``: what visibility the endpoint should have.
|
- ``interface``: what visibility the endpoint should have.
|
||||||
- ``region_name``: the region the endpoint exists in.
|
- ``region_name``: the region the endpoint exists in.
|
||||||
|
|
||||||
|
@@ -92,7 +92,7 @@ class BaseIdentityPlugin(base.BaseAuthPlugin):
|
|||||||
return self.auth_ref
|
return self.auth_ref
|
||||||
|
|
||||||
def get_endpoint(self, session, service_type=None, interface=None,
|
def get_endpoint(self, session, service_type=None, interface=None,
|
||||||
region_name=None, **kwargs):
|
region_name=None, service_name=None, **kwargs):
|
||||||
"""Return a valid endpoint for a service.
|
"""Return a valid endpoint for a service.
|
||||||
|
|
||||||
If a valid token is not present then a new one will be fetched using
|
If a valid token is not present then a new one will be fetched using
|
||||||
@@ -106,6 +106,8 @@ class BaseIdentityPlugin(base.BaseAuthPlugin):
|
|||||||
Defaults to `public`.
|
Defaults to `public`.
|
||||||
:param string region_name: The region the endpoint should exist in.
|
:param string region_name: The region the endpoint should exist in.
|
||||||
(optional)
|
(optional)
|
||||||
|
:param string service_name: The name of the service in the catalog.
|
||||||
|
(optional)
|
||||||
|
|
||||||
:raises HttpError: An error from an invalid HTTP response.
|
:raises HttpError: An error from an invalid HTTP response.
|
||||||
|
|
||||||
@@ -123,7 +125,8 @@ class BaseIdentityPlugin(base.BaseAuthPlugin):
|
|||||||
service_catalog = self.get_access(session).service_catalog
|
service_catalog = self.get_access(session).service_catalog
|
||||||
return service_catalog.url_for(service_type=service_type,
|
return service_catalog.url_for(service_type=service_type,
|
||||||
endpoint_type=interface,
|
endpoint_type=interface,
|
||||||
region_name=region_name)
|
region_name=region_name,
|
||||||
|
service_name=service_name)
|
||||||
|
|
||||||
def invalidate(self):
|
def invalidate(self):
|
||||||
self.auth_ref = None
|
self.auth_ref = None
|
||||||
|
@@ -175,7 +175,9 @@ class V2IdentityPlugin(utils.TestCase):
|
|||||||
self.assertEqual(httpretty.last_request().path, path)
|
self.assertEqual(httpretty.last_request().path, path)
|
||||||
|
|
||||||
def test_service_url(self):
|
def test_service_url(self):
|
||||||
endpoint_filter = {'service_type': 'compute', 'interface': 'admin'}
|
endpoint_filter = {'service_type': 'compute',
|
||||||
|
'interface': 'admin',
|
||||||
|
'service_name': 'nova'}
|
||||||
self._do_service_url_test('http://nova/novapi/admin', endpoint_filter)
|
self._do_service_url_test('http://nova/novapi/admin', endpoint_filter)
|
||||||
|
|
||||||
def test_service_url_defaults_to_public(self):
|
def test_service_url_defaults_to_public(self):
|
||||||
|
@@ -61,7 +61,8 @@ class V3IdentityPlugin(utils.TestCase):
|
|||||||
"region": "RegionOne",
|
"region": "RegionOne",
|
||||||
"interface": "admin"
|
"interface": "admin"
|
||||||
}],
|
}],
|
||||||
"type": "compute"
|
"type": "compute",
|
||||||
|
"name": "nova",
|
||||||
}, {
|
}, {
|
||||||
"endpoints": [{
|
"endpoints": [{
|
||||||
"url": "http://glance/glanceapi/public",
|
"url": "http://glance/glanceapi/public",
|
||||||
@@ -328,7 +329,9 @@ class V3IdentityPlugin(utils.TestCase):
|
|||||||
self.assertEqual(httpretty.last_request().path, path)
|
self.assertEqual(httpretty.last_request().path, path)
|
||||||
|
|
||||||
def test_service_url(self):
|
def test_service_url(self):
|
||||||
endpoint_filter = {'service_type': 'compute', 'interface': 'admin'}
|
endpoint_filter = {'service_type': 'compute',
|
||||||
|
'interface': 'admin',
|
||||||
|
'service_name': 'nova'}
|
||||||
self._do_service_url_test('http://nova/novapi/admin', endpoint_filter)
|
self._do_service_url_test('http://nova/novapi/admin', endpoint_filter)
|
||||||
|
|
||||||
def test_service_url_defaults_to_public(self):
|
def test_service_url_defaults_to_public(self):
|
||||||
|
Reference in New Issue
Block a user