Merge "Add check to expose internal endpoints" into stable/ussuri

This commit is contained in:
Zuul 2023-01-30 23:25:36 +00:00 committed by Gerrit Code Review
commit 0c88f162f2
2 changed files with 11 additions and 1 deletions

View File

@ -214,7 +214,10 @@ def cluster_connected(hacluster):
@reactive.when('dnsaas.connected')
def expose_endpoint(endpoint):
with charm.provide_charm_instance() as instance:
endpoint.expose_endpoint(instance.public_url)
if hookenv.config('use-internal-endpoints'):
endpoint.expose_endpoint(instance.internal_url)
else:
endpoint.expose_endpoint(instance.public_url)
@reactive.when_not('dont-set-assess-status')

View File

@ -143,6 +143,13 @@ class TestHandlers(test_utils.PatchHelper):
keystone = mock.MagicMock()
handlers.maybe_setup_endpoint(keystone)
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):
the_charm = self._patch_provide_charm_instance()