~corey.bryant/charms/trusty/keystone/mkdir755

« back to all changes in this revision

Viewing changes to actions/git_reinstall.py

  • Committer: james.page at ubuntu
  • Date: 2015-04-16 19:55:16 UTC
  • mfrom: (88.4.67 keystone)
  • Revision ID: james.page@ubuntu.com-20150416195516-mr74d2ad5zqmd1tb
[coreycb,r=james-page] Add deploy from source support

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 keystone_utils import (
 
18
    git_install,
 
19
)
 
20
 
 
21
from keystone_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()