~bigdata-dev/charms/trusty/apache-hadoop-hdfs-master/ganglia_metrics

« back to all changes in this revision

Viewing changes to hooks/setup.py

  • Committer: Kevin W. Monroe
  • Date: 2015-06-29 14:19:09 UTC
  • mfrom: (82.1.7 apache-hadoop-hdfs-master)
  • Revision ID: kevin.monroe@canonical.com-20150629141909-tsk36o9h5cr12kco
bundle resources into charm for ease of install; add extended status messages; add actions to start/stop the cluster

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
import subprocess
13
13
from glob import glob
14
14
 
 
15
 
15
16
def pre_install():
16
17
    """
17
18
    Do any setup required before the install hook.
18
19
    """
19
20
    install_pip()
20
 
    install_jujuresources()
 
21
    install_bundled_resources()
21
22
 
22
23
 
23
24
def install_pip():
24
25
    subprocess.check_call(['apt-get', 'install', '-yq', 'python-pip', 'bzr'])
25
26
 
26
27
 
27
 
def install_jujuresources():
28
 
    """
29
 
    Install the bundled jujuresources library, if not present.
30
 
    """
31
 
    try:
32
 
        import jujuresources  # noqa
33
 
    except ImportError:
34
 
        jr_archive = glob('resources/jujuresources-*.tar.gz')[0]
35
 
        subprocess.check_call(['pip', 'install', jr_archive])
 
28
def install_bundled_resources():
 
29
    """
 
30
    Install the bundled resources libraries.
 
31
    """
 
32
    archives = glob('resources/python/*')
 
33
    subprocess.check_call(['pip', 'install'] + archives)