Action managed openstack upgrade support
This commit is contained in:
parent
49e8638c29
commit
42a75be9be
4
actions.yaml
Normal file
4
actions.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
openstack-upgrade:
|
||||
description: |
|
||||
Perform openstack upgrades. Config option action-managed-upgrade must be
|
||||
set to True.
|
1
actions/openstack-upgrade
Symbolic link
1
actions/openstack-upgrade
Symbolic link
@ -0,0 +1 @@
|
||||
openstack_upgrade.py
|
38
actions/openstack_upgrade.py
Executable file
38
actions/openstack_upgrade.py
Executable file
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
import uuid
|
||||
|
||||
sys.path.append('hooks/')
|
||||
|
||||
from charmhelpers.contrib.openstack.utils import (
|
||||
do_action_openstack_upgrade,
|
||||
)
|
||||
|
||||
from ceilometer_hooks import config_changed
|
||||
|
||||
from ceilometer_utils import (
|
||||
do_openstack_upgrade,
|
||||
register_configs
|
||||
)
|
||||
|
||||
|
||||
CONFIGS = register_configs()
|
||||
|
||||
|
||||
def openstack_upgrade():
|
||||
"""Perform action-managed OpenStack upgrade.
|
||||
|
||||
Upgrades packages to the configured openstack-origin version and sets
|
||||
the corresponding action status as a result.
|
||||
|
||||
If the charm was installed from source we cannot upgrade it.
|
||||
For backwards compatibility a config flag (action-managed-upgrade) must
|
||||
be set for this code to run, otherwise a full service level upgrade will
|
||||
fire on config-changed."""
|
||||
|
||||
if (do_action_openstack_upgrade(do_openstack_upgrade,
|
||||
CONFIGS, package='ceilometer-common')):
|
||||
config_changed()
|
||||
|
||||
if __name__ == '__main__':
|
||||
openstack_upgrade()
|
10
config.yaml
10
config.yaml
@ -40,3 +40,13 @@ options:
|
||||
description: |
|
||||
A comma-separated list of nagios servicegroups.
|
||||
If left empty, the nagios_context will be used as the servicegroup
|
||||
action-managed-upgrade:
|
||||
type: boolean
|
||||
default: False
|
||||
description: |
|
||||
If True enables openstack upgrades for this charm via juju actions.
|
||||
You will still need to set openstack-origin to the new repository but
|
||||
instead of an upgrade running automatically across all units, it will
|
||||
wait for you to execute the openstack-upgrade action for this charm on
|
||||
each unit. If False it will revert to existing behavior of upgrading
|
||||
all units on config change.
|
||||
|
@ -61,6 +61,7 @@ def ceilometer_changed():
|
||||
@hooks.hook('config-changed')
|
||||
@restart_on_change(restart_map(), stopstart=True)
|
||||
def config_changed():
|
||||
if not config('action-managed-upgrade'):
|
||||
if openstack_upgrade_available('ceilometer-common'):
|
||||
do_openstack_upgrade(CONFIGS)
|
||||
if is_relation_made('nrpe-external-master'):
|
||||
|
Loading…
Reference in New Issue
Block a user