aboutsummaryrefslogtreecommitdiffstats
path: root/charms/trusty/keepalived/hooks/setup.py
blob: 50854d91985ed8de148a7bc7f13261badd86b237 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
def pre_install():
    """
    Do any setup required before the install hook.
    """
    install_charmhelpers()


def install_charmhelpers():
    """
    Install the charmhelpers library, if not present.
    """
    try:
        import charmhelpers  # noqa
    except ImportError:
        import subprocess
        subprocess.check_call(['apt-get', 'install', '-y', 'python-pip'])
        subprocess.check_call(['pip', 'install', 'charmhelpers'])