Add action to restart services

Adds an action to charms to trigger a service restart.

Depends-On: Ic3521c08cdaa207e1391a32e03e53b276c51b309
Change-Id: I1d509d0bc2c3fb77348edef6810fcdc30cdc9ab8
This commit is contained in:
Liam Young 2018-11-22 10:27:38 +00:00
parent c3cc2414ce
commit 701cf8d2c4
3 changed files with 16 additions and 4 deletions

View File

@ -1,11 +1,15 @@
"pause":
"description": |
pause:
description: |
Pause services.
If the deployment is clustered using the hacluster charm, the
corresponding hacluster unit on the node must first be paused as well.
Not doing so may lead to an interruption of service.
"resume":
"description": |
resume:
description: |
Resume services.
If the deployment is clustered using the hacluster charm, the
corresponding hacluster unit on the node must be resumed as well.
restart-services:
description: |
Restart services.
Restart the services the charm manages.

View File

@ -47,11 +47,18 @@ def resume_action(*args):
charm_instance._assess_status()
def restart_services(*args):
"""Run the resume action."""
with charms_openstack.charm.provide_charm_instance() as charm_instance:
charm_instance.restart_services()
# Actions to function mapping, to allow for illegal python action names that
# can map to a python function.
ACTIONS = {
"pause": pause_action,
"resume": resume_action,
"restart-services": restart_services,
}

1
actions/restart-services Symbolic link
View File

@ -0,0 +1 @@
os_actions.py