~1chb1n/charms/trusty/cinder/15.10-stable-flip-tests-helper-syncs

« back to all changes in this revision

Viewing changes to actions/openstack_upgrade.py

  • Committer: James Page
  • Date: 2015-10-22 13:19:13 UTC
  • Revision ID: james.page@ubuntu.com-20151022131913-02u2l9s2fa0xtbio
Tags: 15.10
15.10 Charm release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
import sys
 
3
import uuid
 
4
 
 
5
sys.path.append('hooks/')
 
6
 
 
7
from charmhelpers.contrib.openstack.utils import (
 
8
    do_action_openstack_upgrade,
 
9
)
 
10
 
 
11
from charmhelpers.core.hookenv import (
 
12
    relation_ids,
 
13
    relation_set,
 
14
)
 
15
 
 
16
from cinder_hooks import (
 
17
    config_changed,
 
18
    CONFIGS,
 
19
)
 
20
 
 
21
from cinder_utils import (
 
22
    do_openstack_upgrade,
 
23
)
 
24
 
 
25
 
 
26
def openstack_upgrade():
 
27
    """Upgrade packages to config-set Openstack version.
 
28
 
 
29
    If the charm was installed from source we cannot upgrade it.
 
30
    For backwards compatibility a config flag must be set for this
 
31
    code to run, otherwise a full service level upgrade will fire
 
32
    on config-changed."""
 
33
 
 
34
    if (do_action_openstack_upgrade('cinder-common',
 
35
                                    do_openstack_upgrade,
 
36
                                    CONFIGS)):
 
37
        # tell any storage-backends we just upgraded
 
38
        for rid in relation_ids('storage-backend'):
 
39
            relation_set(relation_id=rid,
 
40
                         upgrade_nonce=uuid.uuid4())
 
41
        config_changed()
 
42
 
 
43
if __name__ == '__main__':
 
44
    openstack_upgrade()