Merge lp:~brad-marshall/charms/trusty/nagios/fix-pagerduty-cron into lp:charms/trusty/nagios

Proposed by Brad Marshall
Status: Merged
Merged at revision: 34
Proposed branch: lp:~brad-marshall/charms/trusty/nagios/fix-pagerduty-cron
Merge into: lp:charms/trusty/nagios
Diff against target: 29 lines (+8/-3)
2 files modified
hooks/templates/nagios-pagerduty-flush-cron.tmpl (+2/-1)
hooks/upgrade-charm (+6/-2)
To merge this branch: bzr merge lp:~brad-marshall/charms/trusty/nagios/fix-pagerduty-cron
Reviewer Review Type Date Requested Status
Stuart Bishop (community) Approve
Review via email: mp+274094@code.launchpad.net

Description of the change

Added passing of the pagerduty queue dir to the cronjob.

To post a comment you must log in.
Revision history for this message
Stuart Bishop (stub) wrote :

Looks good to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== renamed file 'files/nagios-pagerduty-flush-cron' => 'hooks/templates/nagios-pagerduty-flush-cron.tmpl'
2--- files/nagios-pagerduty-flush-cron 2015-07-22 03:31:36 +0000
3+++ hooks/templates/nagios-pagerduty-flush-cron.tmpl 2015-10-12 00:58:21 +0000
4@@ -4,4 +4,5 @@
5
6 # Flush the nagios pagerduty alerts every minute as per
7 # http://www.pagerduty.com/docs/guides/nagios-perl-integration-guide/
8-* * * * * nagios /usr/local/bin/pagerduty_nagios.pl flush
9+* * * * * nagios /usr/local/bin/pagerduty_nagios.pl flush --queue-dir {{ pagerduty_path }}
10+
11
12=== modified file 'hooks/upgrade-charm'
13--- hooks/upgrade-charm 2015-10-08 18:40:52 +0000
14+++ hooks/upgrade-charm 2015-10-12 00:58:21 +0000
15@@ -123,8 +123,12 @@
16 with open(pagerduty_cfg, 'w') as f:
17 f.write(t.render(template_values))
18
19- # Ship the cron file
20- shutil.copyfile('files/nagios-pagerduty-flush-cron', pagerduty_cron)
21+ with open('hooks/templates/nagios-pagerduty-flush-cron.tmpl', 'r') as f2:
22+ templateDef = f2.read()
23+
24+ t2 = Template(templateDef)
25+ with open(pagerduty_cron, 'w') as f2:
26+ f2.write(t2.render(template_values))
27
28 # Ship the pagerduty_nagios.pl script
29 shutil.copyfile('files/pagerduty_nagios.pl', '/usr/local/bin/pagerduty_nagios.pl')

Subscribers

People subscribed via source and target branches

to all changes: