Don't make any changes during update-status hooks

Previously the config_changed function was invoked during the
update-status hooks. And it made unnecessary changes to the system.
Guard reactive functions properly.

> INFO unit.ceph-fs/0.juju-log Invoking reactive handler:
> reactive/ceph_fs.py:42:config_changed

Closes-Bug: #2074349
Related-Bug: #2071780
Change-Id: If6cd061fef4c3625d6d498942949e31f243622df
This commit is contained in:
Nobuto Murata 2024-07-29 22:36:14 +09:00
parent ec41cb0e41
commit 032949448f
2 changed files with 9 additions and 4 deletions

View File

@ -41,7 +41,7 @@ charm.use_defaults(
)
@reactive.when_none('charm.paused', 'run-default-update-status')
@reactive.when_none('charm.paused', 'is-update-status-hook')
@reactive.when('ceph-mds.pools.available')
def config_changed():
ceph_mds = reactive.endpoint_from_flag('ceph-mds.pools.available')
@ -77,6 +77,7 @@ def config_changed():
str(exc))
@reactive.when_none('charm.paused', 'is-update-status-hook')
@reactive.when('ceph-mds.connected')
def storage_ceph_connected(ceph):
ceph_mds = reactive.endpoint_from_flag('ceph-mds.connected')
@ -219,7 +220,7 @@ def storage_ceph_connected(ceph):
ceph_mds.send_request_if_needed(rq)
@reactive.when_none('charm.paused', 'run-default-update-status')
@reactive.when_none('charm.paused', 'is-update-status-hook')
@reactive.when('cephfs.configured', 'ceph-mds.pools.available',
'cephfs-share.available')
def cephfs_share_available():

View File

@ -47,11 +47,15 @@ class TestRegisteredHooks(test_utils.TestRegisteredHooks):
'when_none': {
'config_changed': (
'charm.paused',
'run-default-update-status',
'is-update-status-hook',
),
'storage_ceph_connected': (
'charm.paused',
'is-update-status-hook',
),
'cephfs_share_available': (
'charm.paused',
'run-default-update-status',
'is-update-status-hook',
),
},
}