Add check to expose internal endpoints
Currently, the charm ignores the use-internal-endpoints config option that is being inherited from the Openstack Layer. This patch adds a check to ensure that the internal endpoint is exposed if this is set to True. Closes-bug: #1995188 Change-Id: I48a04ac619204ba109d87ca05de7cbe308592486
This commit is contained in:
parent
f87d01015b
commit
8a4940bbb1
|
@ -242,6 +242,9 @@ def cluster_connected(hacluster):
|
||||||
@reactive.when('dnsaas.connected')
|
@reactive.when('dnsaas.connected')
|
||||||
def expose_endpoint(endpoint):
|
def expose_endpoint(endpoint):
|
||||||
with charm.provide_charm_instance() as instance:
|
with charm.provide_charm_instance() as instance:
|
||||||
|
if hookenv.config('use-internal-endpoints'):
|
||||||
|
endpoint.expose_endpoint(instance.internal_url)
|
||||||
|
else:
|
||||||
endpoint.expose_endpoint(instance.public_url)
|
endpoint.expose_endpoint(instance.public_url)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -147,8 +147,14 @@ class TestHandlers(test_utils.PatchHelper):
|
||||||
self.is_data_changed().__exit__.return_value = None
|
self.is_data_changed().__exit__.return_value = None
|
||||||
keystone = mock.MagicMock()
|
keystone = mock.MagicMock()
|
||||||
handlers.maybe_setup_endpoint(keystone)
|
handlers.maybe_setup_endpoint(keystone)
|
||||||
self.is_data_changed.called_once_with(mock.ANY, args)
|
|
||||||
keystone.register_endpoints.assert_called_once_with(*args)
|
keystone.register_endpoints.assert_called_once_with(*args)
|
||||||
|
endpoint = mock.MagicMock()
|
||||||
|
handlers.expose_endpoint(endpoint)
|
||||||
|
endpoint.expose_endpoint.assert_called_once_with('i1')
|
||||||
|
endpoint = mock.MagicMock()
|
||||||
|
self.patch_object(handlers.hookenv, 'config', return_value=False)
|
||||||
|
handlers.expose_endpoint(endpoint)
|
||||||
|
endpoint.expose_endpoint.assert_called_once_with('p1')
|
||||||
|
|
||||||
def test_configure_designate_basic(self):
|
def test_configure_designate_basic(self):
|
||||||
the_charm = self._patch_provide_charm_instance()
|
the_charm = self._patch_provide_charm_instance()
|
||||||
|
|
Loading…
Reference in New Issue