Merge lp:~ev/charms/precise/postgresql/non-fatal-sysctl into lp:charms/postgresql

Proposed by Evan
Status: Merged
Merged at revision: 103
Proposed branch: lp:~ev/charms/precise/postgresql/non-fatal-sysctl
Merge into: lp:charms/postgresql
Diff against target: 13 lines (+2/-1)
1 file modified
hooks/hooks.py (+2/-1)
To merge this branch: bzr merge lp:~ev/charms/precise/postgresql/non-fatal-sysctl
Reviewer Review Type Date Requested Status
Stuart Bishop (community) Approve
Review via email: mp+236322@code.launchpad.net

Description of the change

The postgresql charm fails to deploy under LXC when it tries to call sysctl. This branch makes the sysctl commands non-fatal on error.

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

Thanks. This looks good.

My initial thought was that we should log a warning if sysctl failed, but I realized that it is unnecessary as we don't specify quiet=True in the call to run(), so errors are already being emitted to the logs.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/hooks.py'
2--- hooks/hooks.py 2014-09-22 08:54:38 +0000
3+++ hooks/hooks.py 2014-09-29 13:14:21 +0000
4@@ -360,7 +360,8 @@
5
6 def _run_sysctl(postgresql_sysctl):
7 """sysctl -p postgresql_sysctl, helper for easy test mocking."""
8- return run("sysctl -p {}".format(postgresql_sysctl))
9+ # Do not error out when this fails. It is not likely to work under LXC.
10+ return run("sysctl -p {}".format(postgresql_sysctl), exit_on_error=False)
11
12
13 def create_postgresql_config(config_file):

Subscribers

People subscribed via source and target branches