~james-page/charms/trusty/nova-cloud-controller/fixup-allowedunits-migration

« back to all changes in this revision

Viewing changes to actions/git_reinstall.py

  • Committer: james.page at ubuntu
  • Date: 2015-04-20 10:21:36 UTC
  • Revision ID: james.page@ubuntu.com-20150420102136-uj9hjyr5llwmjf59
Revert previous commit, work incomplete

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python
2
 
import sys
3
 
import traceback
4
 
 
5
 
sys.path.append('hooks/')
6
 
 
7
 
from charmhelpers.contrib.openstack.utils import (
8
 
    git_install_requested,
9
 
)
10
 
 
11
 
from charmhelpers.core.hookenv import (
12
 
    action_set,
13
 
    action_fail,
14
 
    config,
15
 
)
16
 
 
17
 
from nova_cc_utils import (
18
 
    git_install,
19
 
)
20
 
 
21
 
from nova_cc_hooks import (
22
 
    config_changed,
23
 
)
24
 
 
25
 
 
26
 
def git_reinstall():
27
 
    """Reinstall from source and restart services.
28
 
 
29
 
    If the openstack-origin-git config option was used to install openstack
30
 
    from source git repositories, then this action can be used to reinstall
31
 
    from updated git repositories, followed by a restart of services."""
32
 
    if not git_install_requested():
33
 
        action_fail('openstack-origin-git is not configured')
34
 
        return
35
 
 
36
 
    try:
37
 
        git_install(config('openstack-origin-git'))
38
 
        config_changed()
39
 
    except:
40
 
        action_set({'traceback': traceback.format_exc()})
41
 
        action_fail('git-reinstall resulted in an unexpected error')
42
 
 
43
 
 
44
 
if __name__ == '__main__':
45
 
    git_reinstall()