~stub/charms/precise/postgresql/metrics

« back to all changes in this revision

Viewing changes to hooks/hooks.py

  • Committer: Stuart Bishop
  • Date: 2014-11-11 05:59:56 UTC
  • Revision ID: stuart@stuartbishop.net-20141111055956-tj84hwbt1zz4qe2m
Review feedback

Show diffs side-by-side

added added

removed removed

Lines of Context:
2184
2184
            or not metrics_sample_interval):
2185
2185
        log("Required config not found or invalid "
2186
2186
            "(metrics_target, metrics_sample_interval), "
2187
 
            "disabling metrics")
 
2187
            "disabling metrics", WARNING)
2188
2188
        delete_metrics_cronjob(cron_path)
2189
2189
        return
2190
2190
 
2195
2195
        "$UNIT", hookenv.local_unit().replace('.', '-').replace('/', '-'))
2196
2196
 
2197
2197
    # ensure script installed
2198
 
    shutil.copy2('%s/files/metrics/postgres_to_statsd.py' % charm_dir,
2199
 
                 script_path)
 
2198
    host.write_file(
 
2199
        os.path.join(charm_dir, 'files', 'metrics', 'postgres_to_statsd.py'),
 
2200
        open(script_path, 'rb').read())
2200
2201
 
2201
2202
    # write the crontab
2202
2203
    with open(cron_path, 'w') as cronjob: