Merge ~barryprice/postgresql-charm/+git/postgresql-charm:master into postgresql-charm:master

Proposed by Barry Price
Status: Merged
Merged at revision: 7f35008bca9fcd37d3ea37fcdccdd32c4c32e142
Proposed branch: ~barryprice/postgresql-charm/+git/postgresql-charm:master
Merge into: postgresql-charm:master
Diff against target: 39 lines (+9/-3)
2 files modified
config.yaml (+1/-1)
reactive/postgresql/nagios.py (+8/-2)
Reviewer Review Type Date Requested Status
Stuart Bishop (community) Approve
Review via email: mp+363823@code.launchpad.net

Commit message

Fix mis-named config variable, guard against empty wal-e backup thershold charm config (use the default values if we get a None)

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Stuart Bishop (stub) wrote :

Yup

review: Approve
Revision history for this message
Stuart Bishop (stub) wrote :

I don't think it is possible to get a None value with current juju and the corrected config.yaml, because the type is int and Juju enforces this. But better safe than sorry.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/config.yaml b/config.yaml
index 94daff9..1c5565a 100644
--- a/config.yaml
+++ b/config.yaml
@@ -170,7 +170,7 @@ options:
170 You need enough space for this many backups plus one more, as170 You need enough space for this many backups plus one more, as
171 an old backup will only be removed after a new one has been171 an old backup will only be removed after a new one has been
172 successfully made to replace it.172 successfully made to replace it.
173 wal_e_backup_stale_warn_threshold:173 wal_e_backup_stale_crit_threshold:
174 type: int174 type: int
175 default: 300175 default: 300
176 description: >176 description: >
diff --git a/reactive/postgresql/nagios.py b/reactive/postgresql/nagios.py
index 7fe3134..415e687 100644
--- a/reactive/postgresql/nagios.py
+++ b/reactive/postgresql/nagios.py
@@ -126,13 +126,19 @@ def update_nrpe_config():
126 user='postgres', group='postgres')126 user='postgres', group='postgres')
127127
128 # retrieve the threshold values from the charm config128 # retrieve the threshold values from the charm config
129 check_warn_threshold = helpers.config_yaml().get(129 check_warn_threshold = hookenv.config().get(
130 'wal_e_backup_stale_warn_threshold'130 'wal_e_backup_stale_warn_threshold'
131 )131 )
132 check_crit_threshold = helpers.config_yaml().get(132 check_crit_threshold = hookenv.config().get(
133 'wal_e_backup_stale_crit_threshold'133 'wal_e_backup_stale_crit_threshold'
134 )134 )
135135
136 # deal with empty stale backup thresholds
137 if check_crit_threshold is None:
138 check_crit_threshold = 300
139 if check_warn_threshold is None:
140 check_warn_threshold = 600
141
136 # create the cron job to run the above142 # create the cron job to run the above
137 check_cron = "*/2 * * * * postgres {}".format(check_script_path)143 check_cron = "*/2 * * * * postgres {}".format(check_script_path)
138 check_cron_path = '/etc/cron.d/postgres-stale-wal-e-check'144 check_cron_path = '/etc/cron.d/postgres-stale-wal-e-check'

Subscribers

People subscribed via source and target branches

to all changes: