~hopem/charms/trusty/swift-proxy/lp1510940

« back to all changes in this revision

Viewing changes to actions/openstack_upgrade.py

  • Committer: james.page at ubuntu
  • Date: 2015-09-24 16:38:37 UTC
  • mfrom: (112.1.1 swift-proxy)
  • Revision ID: james.page@ubuntu.com-20150924163837-a6b2yxjvjq9wxzh7
[thedac,r=james-page] Add action managed upgrade support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
import sys
 
3
 
 
4
sys.path.append('hooks/')
 
5
 
 
6
from charmhelpers.contrib.openstack.utils import (
 
7
    do_action_openstack_upgrade,
 
8
)
 
9
 
 
10
from swift_hooks import (
 
11
    config_changed,
 
12
    CONFIGS,
 
13
)
 
14
 
 
15
from lib.swift_utils import (
 
16
    do_openstack_upgrade,
 
17
)
 
18
 
 
19
 
 
20
def openstack_upgrade():
 
21
    """Upgrade packages to config-set Openstack version.
 
22
 
 
23
    If the charm was installed from source we cannot upgrade it.
 
24
    For backwards compatibility a config flag must be set for this
 
25
    code to run, otherwise a full service level upgrade will fire
 
26
    on config-changed."""
 
27
 
 
28
    if (do_action_openstack_upgrade('python-swift',
 
29
                                    do_openstack_upgrade,
 
30
                                    CONFIGS)):
 
31
        config_changed()
 
32
 
 
33
if __name__ == '__main__':
 
34
    openstack_upgrade()