Use charm-helpers for action managed openstack upgrade.
This commit is contained in:
parent
db7f68241b
commit
3143fa7c1b
|
@ -1,26 +1,15 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
sys.path.append('hooks/')
|
sys.path.append('hooks/')
|
||||||
|
|
||||||
from charmhelpers.core.hookenv import (
|
from charmhelpers.core.hookenv import (
|
||||||
action_set,
|
|
||||||
action_fail,
|
|
||||||
config,
|
config,
|
||||||
relation_ids,
|
|
||||||
relation_set
|
|
||||||
)
|
)
|
||||||
|
|
||||||
from cinder_hooks import config_changed
|
from cinder_hooks import config_changed
|
||||||
|
|
||||||
from charmhelpers.contrib.openstack.utils import (
|
|
||||||
juju_log,
|
|
||||||
git_install_requested,
|
|
||||||
openstack_upgrade_available
|
|
||||||
)
|
|
||||||
|
|
||||||
from cinder_utils import (
|
from cinder_utils import (
|
||||||
do_openstack_upgrade,
|
do_openstack_upgrade,
|
||||||
register_configs
|
register_configs
|
||||||
|
@ -38,35 +27,16 @@ def openstack_upgrade():
|
||||||
code to run, otherwise a full service level upgrade will fire
|
code to run, otherwise a full service level upgrade will fire
|
||||||
on config-changed."""
|
on config-changed."""
|
||||||
|
|
||||||
if git_install_requested():
|
if (do_action_openstack_upgrade('cinder-common',
|
||||||
action_set({'outcome': 'installed from source, skipped upgrade.'})
|
config('action-managed-upgrade'),
|
||||||
else:
|
do_openstack_upgrade(),
|
||||||
if openstack_upgrade_available('cinder-common'):
|
CONFIGS)):
|
||||||
if config('action-managed-upgrade'):
|
# NOTE(jamespage) tell any storage-backends we just
|
||||||
juju_log('Upgrading OpenStack release')
|
# upgraded
|
||||||
|
for rid in relation_ids('storage-backend'):
|
||||||
try:
|
relation_set(relation_id=rid,
|
||||||
do_openstack_upgrade(configs=CONFIGS)
|
upgrade_nonce=uuid.uuid4())
|
||||||
|
config_changed()
|
||||||
# NOTE(jamespage) tell any storage-backends we just
|
|
||||||
# upgraded
|
|
||||||
for rid in relation_ids('storage-backend'):
|
|
||||||
relation_set(relation_id=rid,
|
|
||||||
upgrade_nonce=uuid.uuid4())
|
|
||||||
|
|
||||||
action_set({'outcome': 'success, upgrade completed.'})
|
|
||||||
except:
|
|
||||||
action_set({'outcome': 'upgrade failed, see traceback.'})
|
|
||||||
action_set({'traceback': traceback.format_exc()})
|
|
||||||
action_fail('do_openstack_upgrade resulted in an '
|
|
||||||
'unexpected error')
|
|
||||||
|
|
||||||
config_changed()
|
|
||||||
else:
|
|
||||||
action_set({'outcome': 'action-managed-upgrade config is '
|
|
||||||
'False, skipped upgrade.'})
|
|
||||||
else:
|
|
||||||
action_set({'outcome': 'no upgrade available.'})
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
openstack_upgrade()
|
openstack_upgrade()
|
||||||
|
|
Loading…
Reference in New Issue