Prevent update-status to run unrequired handlers
Before the update-status hook would run handlers that are expected to run when the configuration changes or relations added/removed. The update-status hook doesn't hold the machine lock which makes concurrent hook executions possible and seen in the gate where for example multiple "apt-get" executions trying to acquire dpkg's lock. Closes-Bug: #2016893 Change-Id: I63bfd9903057cbea2db8de4f1b612601aacb568d
This commit is contained in:
parent
dc8a5899fb
commit
97223f60ac
|
@ -34,6 +34,7 @@ charms_openstack.charm.use_defaults(
|
|||
)
|
||||
|
||||
|
||||
@reactive.when_not('is-update-status-hook')
|
||||
@reactive.when('shared-db.available')
|
||||
@reactive.when('identity-service.available')
|
||||
def render_config(*args):
|
||||
|
@ -60,6 +61,7 @@ def render_config(*args):
|
|||
reactive.set_state('config.rendered')
|
||||
|
||||
|
||||
@reactive.when_not('is-update-status-hook')
|
||||
@reactive.when('config.rendered')
|
||||
@reactive.when('placement.available')
|
||||
@reactive.when_not('db.synced')
|
||||
|
@ -77,6 +79,7 @@ def init_db():
|
|||
reactive.set_state('db.synced')
|
||||
|
||||
|
||||
@reactive.when_not('is-update-status-hook')
|
||||
@reactive.when('ha.connected')
|
||||
def cluster_connected(hacluster):
|
||||
"""Configure HA resources in corosync"""
|
||||
|
|
|
@ -40,7 +40,9 @@ class TestRegisteredHooks(test_utils.TestRegisteredHooks):
|
|||
'cluster_connected': ('ha.connected',),
|
||||
},
|
||||
'when_not': {
|
||||
'init_db': ('db.synced',),
|
||||
'init_db': ('db.synced', 'is-update-status-hook'),
|
||||
'render_config': ('is-update-status-hook', ),
|
||||
'cluster_connected': ('is-update-status-hook', ),
|
||||
},
|
||||
}
|
||||
# test that the hooks were registered via the
|
||||
|
|
Loading…
Reference in New Issue