Merge "Stop charm running handlers during update-status"
This commit is contained in:
commit
6c11e92bff
|
@ -48,6 +48,7 @@ storage_config = ['config.changed.storage-backend',
|
||||||
'config.changed.s3-secret-access-key']
|
'config.changed.s3-secret-access-key']
|
||||||
|
|
||||||
|
|
||||||
|
@reactive.when_not('is-update-status-hook')
|
||||||
@reactive.when_any(*storage_config)
|
@reactive.when_any(*storage_config)
|
||||||
def storage_backend_connection():
|
def storage_backend_connection():
|
||||||
"""Test the connection to the S3 backend provided."""
|
"""Test the connection to the S3 backend provided."""
|
||||||
|
@ -104,6 +105,7 @@ def storage_backend_connection():
|
||||||
reactive.set_flag('gnocchi-upgrade.ready')
|
reactive.set_flag('gnocchi-upgrade.ready')
|
||||||
|
|
||||||
|
|
||||||
|
@reactive.when_not('is-update-status-hook')
|
||||||
@reactive.when('gnocchi-upgrade.ready')
|
@reactive.when('gnocchi-upgrade.ready')
|
||||||
@reactive.when(*required_interfaces)
|
@reactive.when(*required_interfaces)
|
||||||
def render_config(*args):
|
def render_config(*args):
|
||||||
|
@ -125,6 +127,7 @@ def render_config(*args):
|
||||||
|
|
||||||
|
|
||||||
# db_sync checks if sync has been done so rerunning is a noop.
|
# db_sync checks if sync has been done so rerunning is a noop.
|
||||||
|
@reactive.when_not('is-update-status-hook')
|
||||||
@reactive.when('config.rendered')
|
@reactive.when('config.rendered')
|
||||||
@reactive.when_not('db.synced')
|
@reactive.when_not('db.synced')
|
||||||
def init_db():
|
def init_db():
|
||||||
|
@ -135,6 +138,7 @@ def init_db():
|
||||||
reactive.set_state('db.synced')
|
reactive.set_state('db.synced')
|
||||||
|
|
||||||
|
|
||||||
|
@reactive.when_not('is-update-status-hook')
|
||||||
@reactive.when('ha.connected')
|
@reactive.when('ha.connected')
|
||||||
@reactive.when_not('ha.available')
|
@reactive.when_not('ha.available')
|
||||||
def cluster_connected(hacluster):
|
def cluster_connected(hacluster):
|
||||||
|
@ -144,6 +148,7 @@ def cluster_connected(hacluster):
|
||||||
charm_class.assess_status()
|
charm_class.assess_status()
|
||||||
|
|
||||||
|
|
||||||
|
@reactive.when_not('is-update-status-hook')
|
||||||
@reactive.when_not('ceph.create_pool.req.sent')
|
@reactive.when_not('ceph.create_pool.req.sent')
|
||||||
@reactive.when('storage-ceph.connected')
|
@reactive.when('storage-ceph.connected')
|
||||||
def storage_ceph_connected(ceph):
|
def storage_ceph_connected(ceph):
|
||||||
|
@ -151,6 +156,7 @@ def storage_ceph_connected(ceph):
|
||||||
reactive.set_state('ceph.create_pool.req.sent')
|
reactive.set_state('ceph.create_pool.req.sent')
|
||||||
|
|
||||||
|
|
||||||
|
@reactive.when_not('is-update-status-hook')
|
||||||
@reactive.when('storage-ceph.available')
|
@reactive.when('storage-ceph.available')
|
||||||
def configure_ceph(ceph):
|
def configure_ceph(ceph):
|
||||||
with charm.provide_charm_instance() as charm_instance:
|
with charm.provide_charm_instance() as charm_instance:
|
||||||
|
@ -161,12 +167,14 @@ def configure_ceph(ceph):
|
||||||
hookenv.log("No ceph keyring data is available")
|
hookenv.log("No ceph keyring data is available")
|
||||||
|
|
||||||
|
|
||||||
|
@reactive.when_not('is-update-status-hook')
|
||||||
@reactive.when_not('storage-ceph.pools.available')
|
@reactive.when_not('storage-ceph.pools.available')
|
||||||
@reactive.when('storage-ceph.connected')
|
@reactive.when('storage-ceph.connected')
|
||||||
def check_ceph_request_status(ceph):
|
def check_ceph_request_status(ceph):
|
||||||
ceph.changed()
|
ceph.changed()
|
||||||
|
|
||||||
|
|
||||||
|
@reactive.when_not('is-update-status-hook')
|
||||||
@reactive.when('storage-ceph.needed')
|
@reactive.when('storage-ceph.needed')
|
||||||
@reactive.when_not('storage-ceph.connected')
|
@reactive.when_not('storage-ceph.connected')
|
||||||
def storage_ceph_disconnected():
|
def storage_ceph_disconnected():
|
||||||
|
@ -174,6 +182,7 @@ def storage_ceph_disconnected():
|
||||||
charm_instance.delete_ceph_keyring()
|
charm_instance.delete_ceph_keyring()
|
||||||
|
|
||||||
|
|
||||||
|
@reactive.when_not('is-update-status-hook')
|
||||||
@reactive.when('metric-service.connected')
|
@reactive.when('metric-service.connected')
|
||||||
@reactive.when('config.rendered')
|
@reactive.when('config.rendered')
|
||||||
@reactive.when('db.synced')
|
@reactive.when('db.synced')
|
||||||
|
@ -194,6 +203,7 @@ def provide_gnocchi_url(metric_service):
|
||||||
metric_service.set_gnocchi_url(charm_class.public_url)
|
metric_service.set_gnocchi_url(charm_class.public_url)
|
||||||
|
|
||||||
|
|
||||||
|
@reactive.when_not('is-update-status-hook')
|
||||||
@reactive.when('storage-ceph.needed')
|
@reactive.when('storage-ceph.needed')
|
||||||
@reactive.when_not('storage-ceph.connected')
|
@reactive.when_not('storage-ceph.connected')
|
||||||
@reactive.when_not('storage-ceph.pools.available')
|
@reactive.when_not('storage-ceph.pools.available')
|
||||||
|
|
|
@ -71,22 +71,40 @@ class TestRegisteredHooks(test_utils.TestRegisteredHooks):
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
'when_not': {
|
'when_not': {
|
||||||
|
'storage_backend_connection': (
|
||||||
|
'is-update-status-hook',
|
||||||
|
),
|
||||||
|
'render_config': (
|
||||||
|
'is-update-status-hook',
|
||||||
|
),
|
||||||
'storage_ceph_disconnected': (
|
'storage_ceph_disconnected': (
|
||||||
|
'is-update-status-hook',
|
||||||
'storage-ceph.connected',
|
'storage-ceph.connected',
|
||||||
),
|
),
|
||||||
'cluster_connected': (
|
'cluster_connected': (
|
||||||
'ha.available',
|
'ha.available',
|
||||||
|
'is-update-status-hook',
|
||||||
),
|
),
|
||||||
'init_db': (
|
'init_db': (
|
||||||
'db.synced',
|
'db.synced',
|
||||||
|
'is-update-status-hook',
|
||||||
),
|
),
|
||||||
'storage_ceph_connected': (
|
'storage_ceph_connected': (
|
||||||
'ceph.create_pool.req.sent',
|
'ceph.create_pool.req.sent',
|
||||||
|
'is-update-status-hook',
|
||||||
|
),
|
||||||
|
'configure_ceph': (
|
||||||
|
'is-update-status-hook',
|
||||||
|
),
|
||||||
|
'provide_gnocchi_url': (
|
||||||
|
'is-update-status-hook',
|
||||||
),
|
),
|
||||||
'check_ceph_request_status': (
|
'check_ceph_request_status': (
|
||||||
|
'is-update-status-hook',
|
||||||
'storage-ceph.pools.available',
|
'storage-ceph.pools.available',
|
||||||
),
|
),
|
||||||
'reset_state_create_pool_req_sent': (
|
'reset_state_create_pool_req_sent': (
|
||||||
|
'is-update-status-hook',
|
||||||
'storage-ceph.connected',
|
'storage-ceph.connected',
|
||||||
'storage-ceph.pools.available',
|
'storage-ceph.pools.available',
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in New Issue