Use default_update_peers

Use default_update_peers which will publish admin, internal and public
addresses to peers. Remove duplicate update_peers from handlers.

Includes fixes for pep8 failures.

Change-Id: I89f2448b4deb71271f7ef0560d9a2607f21ae6c7
Closes-Bug: #1858132
This commit is contained in:
David Ames 2020-03-27 14:55:58 -07:00 committed by James Page
parent 12bede2b11
commit 21db962b16
4 changed files with 3 additions and 16 deletions

View File

@ -27,6 +27,7 @@ from charms_openstack.charm.utils import is_data_changed
charm.use_defaults(
'certificates.available',
'cluster.available',
)
# If either dns-backend.available is set OR config('dns-slaves') is valid, then
@ -161,15 +162,6 @@ def sync_pool_manager_cache(*args):
reactive.set_state('pool-manager-cache.synched')
@reactive.when('cluster.available')
def update_peers(cluster):
"""Inform designate peers about this unit"""
with charm.provide_charm_instance() as instance:
# This function ONLY updates the peers if the data has changed. Thus
# it's okay to call it on every hook invocation.
instance.update_peers(cluster)
@reactive.when('db.synched')
@reactive.when('pool-manager-cache.synched')
@reactive.when(*COMPLETE_INTERFACE_STATES)

View File

@ -3,7 +3,7 @@
# requirements management in charms via bot-control. Thank you.
#
# Lint and unit test requirements
flake8>=2.2.4,<=2.4.1
flake8>=2.2.4
stestr>=2.2.0
requests>=2.18.4
charms.reactive

View File

@ -32,6 +32,7 @@ def _fake_retry(num_retries, base_delay=0, exc_type=Exception):
return _retry_on_exception_inner_2
return _retry_on_exception_inner_1
mock.patch(
'charmhelpers.core.decorators.retry_on_exception',
_fake_retry).start()

View File

@ -24,7 +24,6 @@ class TestRegisteredHooks(test_utils.TestRegisteredHooks):
'maybe_setup_endpoint': ('identity-service.connected', ),
'expose_rndc_address': ('cluster.connected', ),
'configure_ssl': ('identity-service.available', ),
'update_peers': ('cluster.available', ),
'config_changed': ('config.changed', ),
'cluster_connected': ('ha.connected', ),
'create_servers_and_domains': (
@ -170,11 +169,6 @@ class TestHandlers(test_utils.PatchHelper):
the_charm.pool_manager_cache_sync.assert_called_once_with()
self.set_state.assert_called_once_with('pool-manager-cache.synched')
def test_update_peers(self):
the_charm = self._patch_provide_charm_instance()
handlers.update_peers('cluster')
the_charm.update_peers.assert_called_once_with('cluster')
def test_configure_designate_full(self):
the_charm = self._patch_provide_charm_instance()
self.patch_object(handlers.reactive.RelationBase,