Clear installed flag when trilio source changes

Clear the installed flag when the triliovault-pkg-source option
changes - this ensures that the apt sources are updated but does
not actually upgrade the packages.

Change-Id: Ie94abfc956fb8be6819bf7bb68eec60fee356487
Related-Bug: 1879904
This commit is contained in:
James Page 2020-05-21 10:19:22 +01:00
parent bab659b115
commit 600a086afe
2 changed files with 12 additions and 1 deletions

View File

@ -11,6 +11,7 @@
# limitations under the License.
import charms_openstack.charm as charm
import charms.reactive as reactive
# This charm's library contains all of the handler code associated with
# trilio_horizon_plugin
@ -21,3 +22,9 @@ charm.use_defaults(
"config.changed",
"update-status"
)
@reactive.when("config.changed.triliovault-pkg-source")
def install_source_changed():
"""Trigger re-install of charm if source configuration options change"""
reactive.clear_flag("charm.installed")

View File

@ -97,7 +97,11 @@ class TestDmapiHandlers(test_utils.PatchHelper):
# test that the hooks actually registered the relation expressions that
# are meaningful for this interface: this is to handle regressions.
# The keys are the function names that the hook attaches to.
when_patterns = {}
when_patterns = {
"install_source_changed": (
"config.changed.triliovault-pkg-source",
)
}
when_not_patterns = {}
# check the when hooks are attached to the expected functions
for t, p in [