~hopem/charms/trusty/keystone/charm-helpers-sync-precise-ipv6-haproxy

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/contrib/openstack/context.py

  • Committer: james.page at ubuntu
  • Date: 2014-12-15 09:27:47 UTC
  • Revision ID: james.page@ubuntu.com-20141215092747-rr2ltvdjzc848kra
[trivial] Resync charm-helpers

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
    relation_set,
22
22
    unit_get,
23
23
    unit_private_ip,
 
24
    charm_name,
24
25
    DEBUG,
25
26
    INFO,
26
27
    WARNING,
27
28
    ERROR,
28
29
)
 
30
 
 
31
from charmhelpers.core.sysctl import create as sysctl_create
 
32
 
29
33
from charmhelpers.core.host import (
30
34
    mkdir,
31
35
    write_file,
1015
1019
            ctxt['notifications'] = "True"
1016
1020
 
1017
1021
        return ctxt
 
1022
 
 
1023
 
 
1024
class SysctlContext(OSContextGenerator):
 
1025
    """This context check if the 'sysctl' option exists on configuration
 
1026
    then creates a file with the loaded contents"""
 
1027
    def __call__(self):
 
1028
        sysctl_dict = config('sysctl')
 
1029
        if sysctl_dict:
 
1030
            sysctl_create(sysctl_dict,
 
1031
                          '/etc/sysctl.d/50-{0}.conf'.format(charm_name()))
 
1032
        return {'sysctl': sysctl_dict}