Add post-upgrade-configuration action
Add post-upgrade-configuration action which can be run after a Trilio upgrade. Trilio sometimes updates packages in package repositiories that require DB migrations or config file changes. Since these package updates are not applied by the charm as they would be by changing the openstack-origin or triliovault-pkg-source the charm has no event to react to to automatically perform the post package upgrade actions. This change adds an action `post-upgrade-configuration` which can be run to apply the changes. func-test-pr: https://github.com/openstack-charmers/zaza-openstack-tests/pull/613 Change-Id: I4dcc5d285e705c15ffc72c4497c3154877c7a44f
This commit is contained in:
parent
c7b1058820
commit
5e45300331
|
@ -8,3 +8,4 @@ test-charm/
|
|||
.stestr
|
||||
.coverage
|
||||
cover
|
||||
*.swp
|
||||
|
|
|
@ -16,3 +16,8 @@ ghost-share:
|
|||
description: Comma separated nfs-shares configuration option from secondary deployment. NFS shares must be provided in the same order as the nfs-shares configuration option for the local deployment.
|
||||
required:
|
||||
- nfs-shares
|
||||
post-upgrade-configuration:
|
||||
description: |
|
||||
If the Trilio packages were upgraded outside of the charms control then run
|
||||
this action to rerender configuration files and run any upgrade tasks such
|
||||
as database migrations.
|
||||
|
|
|
@ -66,12 +66,23 @@ def ghost_share(*args):
|
|||
trilio_wlm_charm._assess_status()
|
||||
|
||||
|
||||
def post_upgrade_configuration(*args):
|
||||
"""Run setup after Trilio upgrade.
|
||||
"""
|
||||
with charms_openstack.charm.provide_charm_instance() as trilio_wlm_charm:
|
||||
trilio_wlm_charm.render_all_configs()
|
||||
if hookenv.is_leader():
|
||||
trilio_wlm_charm.do_trilio_upgrade_db_migration()
|
||||
trilio_wlm_charm._assess_status()
|
||||
|
||||
|
||||
# Actions to function mapping, to allow for illegal python action names that
|
||||
# can map to a python function.
|
||||
ACTIONS = {
|
||||
"create-cloud-admin-trust": create_cloud_admin_trust,
|
||||
"create-license": create_license,
|
||||
"ghost-share": ghost_share,
|
||||
"post-upgrade-configuration": post_upgrade_configuration,
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
actions.py
|
Loading…
Reference in New Issue