~corey.bryant/charms/trusty/ceph/render

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/core/services/helpers.py

  • Committer: Edward Hope-Morley
  • Date: 2014-11-25 18:29:07 UTC
  • mfrom: (85.2.4 ceph)
  • Revision ID: edward.hope-morley@canonical.com-20141125182907-oyi0vts2tw6o0a5p
[niedbalski,r=hopem]

Adds sysctl config option to allow dict of
sysctl key/val pairs to be set on ceph nodes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
196
196
        if not os.path.isabs(file_name):
197
197
            file_name = os.path.join(hookenv.charm_dir(), file_name)
198
198
        with open(file_name, 'w') as file_stream:
199
 
            os.fchmod(file_stream.fileno(), 0600)
 
199
            os.fchmod(file_stream.fileno(), 0o600)
200
200
            yaml.dump(config_data, file_stream)
201
201
 
202
202
    def read_context(self, file_name):
211
211
 
212
212
class TemplateCallback(ManagerCallback):
213
213
    """
214
 
    Callback class that will render a Jinja2 template, for use as a ready action.
215
 
 
216
 
    :param str source: The template source file, relative to `$CHARM_DIR/templates`
 
214
    Callback class that will render a Jinja2 template, for use as a ready
 
215
    action.
 
216
 
 
217
    :param str source: The template source file, relative to
 
218
    `$CHARM_DIR/templates`
 
219
 
217
220
    :param str target: The target to write the rendered template to
218
221
    :param str owner: The owner of the rendered file
219
222
    :param str group: The group of the rendered file
220
223
    :param int perms: The permissions of the rendered file
221
224
    """
222
 
    def __init__(self, source, target, owner='root', group='root', perms=0444):
 
225
    def __init__(self, source, target,
 
226
                 owner='root', group='root', perms=0o444):
223
227
        self.source = source
224
228
        self.target = target
225
229
        self.owner = owner