~cf-charmers/charms/trusty/etcd/trunk

« back to all changes in this revision

Viewing changes to hooks/config.py

  • Committer: Alexander Prismakov
  • Date: 2014-06-02 16:45:58 UTC
  • Revision ID: prismakov@gmail.com-20140602164558-fci4fwijz0ainh1p
wip

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# vim: et sta sts ai ts=4 sw=4:
1
2
import os
2
 
from charmhelpers.core import services, templating
 
3
from charmhelpers.core import services, hookenv
3
4
 
4
5
__all__ = ['PACKAGES', 'ETCD_CONFIG_FILE', 'ETCD_BIN_DIR', 'ETCD_USER_NAME']
5
6
 
9
10
PACKAGES = ['python-jinja2']
10
11
ETCD_USER_NAME = 'etcd'
11
12
 
 
13
config_data = hookenv.config()
 
14
 
 
15
 
 
16
EtcdContext = {
 
17
    'bind_port': config_data['bind_port'],
 
18
    'peer_port': config_data['peer_port'],
 
19
    'host': hookenv.unit_privite_ip(),
 
20
}
 
21
 
 
22
 
12
23
SERVICES = [
13
24
    {
14
25
        'service': 'etcd',
15
 
        'required_data': [
16
 
            templating.ConfigContext({'bind_port': bind_port,
17
 
                                      'peer_port': peer_port})
18
 
        ],
 
26
        'required_data': EtcdContext,
19
27
        'data_ready': [
20
28
            services.template(source='upstart-etcd-job.conf',
21
29
                              target='/etc/init/etcd.conf'),