Stop charm running handlers during update-status
Make use of the new `is-update-status-hook` flag for proper gating on handlers during update-status hook. Unpin flake8. Change-Id: I404cc791adb9e469c0c1a3643f944714e1b86491
This commit is contained in:
parent
dde5d1a02a
commit
5b197067ae
@ -30,7 +30,7 @@ charm.use_defaults(
|
||||
)
|
||||
|
||||
|
||||
@reactive.when_none('charm.firewall_initialized')
|
||||
@reactive.when_none('is-update-status-hook', 'charm.firewall_initialized')
|
||||
def initialize_firewall():
|
||||
"""Do one-time initialization of firewall."""
|
||||
with charm.provide_charm_instance() as ovn_charm:
|
||||
@ -38,7 +38,9 @@ def initialize_firewall():
|
||||
reactive.set_flag('charm.firewall_initialized')
|
||||
|
||||
|
||||
@reactive.when_none('leadership.set.nb_cid', 'leadership.set.sb_cid')
|
||||
@reactive.when_none('is-update-status-hook',
|
||||
'leadership.set.nb_cid',
|
||||
'leadership.set.sb_cid')
|
||||
@reactive.when('config.rendered',
|
||||
'certificates.connected',
|
||||
'certificates.available',
|
||||
@ -76,7 +78,7 @@ def announce_leader_ready():
|
||||
})
|
||||
|
||||
|
||||
@reactive.when_none('run-default-update-status', 'leadership.set.nb_cid',
|
||||
@reactive.when_none('is-update-status-hook', 'leadership.set.nb_cid',
|
||||
'leadership.set.sb_cid')
|
||||
@reactive.when('charm.installed', 'leadership.is_leader',
|
||||
'ovsdb-peer.connected')
|
||||
@ -97,7 +99,7 @@ def initialize_ovsdbs():
|
||||
ovn_charm.assess_status()
|
||||
|
||||
|
||||
@reactive.when_none('run-default-update-status', 'leadership.is_leader')
|
||||
@reactive.when_none('is-update-status-hook', 'leadership.is_leader')
|
||||
@reactive.when('charm.installed')
|
||||
def enable_default_certificates():
|
||||
# belated enablement of default certificates handler due to the
|
||||
@ -106,7 +108,7 @@ def enable_default_certificates():
|
||||
charm.use_defaults('certificates.available')
|
||||
|
||||
|
||||
@reactive.when_none('run-default-update-status')
|
||||
@reactive.when_none('is-update-status-hook')
|
||||
@reactive.when('ovsdb-peer.available')
|
||||
def configure_firewall():
|
||||
ovsdb_peer = reactive.endpoint_from_flag('ovsdb-peer.available')
|
||||
@ -126,7 +128,7 @@ def configure_firewall():
|
||||
ovn_charm.assess_status()
|
||||
|
||||
|
||||
@reactive.when_none('run-default-update-status')
|
||||
@reactive.when_none('is-update-status-hook')
|
||||
@reactive.when('ovsdb-peer.available',
|
||||
'leadership.set.nb_cid',
|
||||
'leadership.set.sb_cid',
|
||||
@ -141,7 +143,7 @@ def publish_addr_to_clients():
|
||||
ep.publish_cluster_local_addr(ovsdb_peer.cluster_local_addr)
|
||||
|
||||
|
||||
@reactive.when_none('run-default-update-status')
|
||||
@reactive.when_none('is-update-status-hook')
|
||||
@reactive.when('config.changed.source', 'ovsdb-peer.available')
|
||||
def maybe_do_upgrade():
|
||||
ovsdb_peer = reactive.endpoint_from_flag('ovsdb-peer.available')
|
||||
@ -152,7 +154,7 @@ def maybe_do_upgrade():
|
||||
ovn_charm.assess_status()
|
||||
|
||||
|
||||
@reactive.when_none('run-default-update-status')
|
||||
@reactive.when_none('is-update-status-hook')
|
||||
@reactive.when('ovsdb-peer.available',
|
||||
'leadership.set.nb_cid',
|
||||
'leadership.set.sb_cid',
|
||||
|
@ -4,7 +4,7 @@
|
||||
# https://github.com/openstack-charmers/release-tools
|
||||
#
|
||||
# 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
|
||||
|
@ -31,18 +31,20 @@ class TestRegisteredHooks(test_utils.TestRegisteredHooks):
|
||||
]
|
||||
hook_set = {
|
||||
'when_none': {
|
||||
'announce_leader_ready': ('leadership.set.nb_cid',
|
||||
'announce_leader_ready': ('is-update-status-hook',
|
||||
'leadership.set.nb_cid',
|
||||
'leadership.set.sb_cid'),
|
||||
'configure_firewall': ('run-default-update-status',),
|
||||
'enable_default_certificates': ('run-default-update-status',
|
||||
'configure_firewall': ('is-update-status-hook',),
|
||||
'enable_default_certificates': ('is-update-status-hook',
|
||||
'leadership.is_leader',),
|
||||
'initialize_firewall': ('charm.firewall_initialized',),
|
||||
'initialize_ovsdbs': ('run-default-update-status',
|
||||
'initialize_firewall': ('is-update-status-hook',
|
||||
'charm.firewall_initialized',),
|
||||
'initialize_ovsdbs': ('is-update-status-hook',
|
||||
'leadership.set.nb_cid',
|
||||
'leadership.set.sb_cid',),
|
||||
'maybe_do_upgrade': ('run-default-update-status',),
|
||||
'publish_addr_to_clients': ('run-default-update-status',),
|
||||
'render': ('run-default-update-status',),
|
||||
'maybe_do_upgrade': ('is-update-status-hook',),
|
||||
'publish_addr_to_clients': ('is-update-status-hook',),
|
||||
'render': ('is-update-status-hook',),
|
||||
},
|
||||
'when': {
|
||||
'announce_leader_ready': ('config.rendered',
|
||||
|
Loading…
x
Reference in New Issue
Block a user