~danilo/charms/trusty/haproxy/merge-services-fix

« back to all changes in this revision

Viewing changes to hooks/hooks.py

  • Committer: Christopher Glass
  • Date: 2015-02-06 07:56:03 UTC
  • mfrom: (86.1.4 custom-apt-source-support)
  • Revision ID: christopher.glass@canonical.com-20150206075603-p8qffhhizslhqw3o
[free.ekanayaka][r=tribaal] Add an APT source and key parameter.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
    close_port,
27
27
    unit_get,
28
28
    )
29
 
from charmhelpers.fetch import apt_install
 
29
 
 
30
from charmhelpers.fetch import (
 
31
    apt_install,
 
32
    add_source,
 
33
    apt_update
 
34
)
 
35
 
30
36
from charmhelpers.contrib.charmsupport import nrpe
31
37
 
32
38
 
753
759
    if not os.path.exists(default_haproxy_service_config_dir):
754
760
        os.mkdir(default_haproxy_service_config_dir, 0600)
755
761
 
 
762
    config_data = config_get()
 
763
    add_source(config_data.get('source'), config_data.get('key'))
 
764
    apt_update(fatal=True)
756
765
    apt_install(['haproxy', 'python-jinja2'], fatal=True)
757
766
    ensure_package_status(service_affecting_packages,
758
 
                          config_get('package_status'))
 
767
                          config_data['package_status'])
759
768
    enable_haproxy()
760
769
 
761
770