Merge lp:~verterok/charms/trusty/haproxy/fix-rsyslog-restart-on-pkg-upgrade into lp:~tanuki/charms/trusty/haproxy/trunk

Proposed by Guillermo Gonzalez
Status: Merged
Approved by: Guillermo Gonzalez
Approved revision: 104
Merged at revision: 102
Proposed branch: lp:~verterok/charms/trusty/haproxy/fix-rsyslog-restart-on-pkg-upgrade
Merge into: lp:~tanuki/charms/trusty/haproxy/trunk
Diff against target: 28 lines (+6/-6)
1 file modified
hooks/hooks.py (+6/-6)
To merge this branch: bzr merge lp:~verterok/charms/trusty/haproxy/fix-rsyslog-restart-on-pkg-upgrade
Reviewer Review Type Date Requested Status
Thomi Richards (community) Approve
Review via email: mp+272179@code.launchpad.net

Commit message

Fix if/else ordering in config check (bug introduced in the last changes)

Description of the change

Fix if/else ordering in config check (bug introduced in the last changes)

To post a comment you must log in.
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) :
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 2015-09-22 21:10:38 +0000
3+++ hooks/hooks.py 2015-09-23 21:14:40 +0000
4@@ -957,18 +957,18 @@
5 if not (get_listen_stanzas() == old_stanzas):
6 notify_website()
7 notify_peer()
8+ else:
9+ # XXX Ideally the config should be restored to a working state if the
10+ # check fails, otherwise an inadvertent reload will cause the service
11+ # to be broken.
12+ log("HAProxy configuration check failed, exiting.")
13+ sys.exit(1)
14 if config_data.changed("global_log") or config_data.changed("source"):
15 # restart rsyslog to pickup haproxy rsyslog config
16 # This could be removed once the following bug is fixed in the haproxy
17 # package:
18 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=790871
19 service_restart("rsyslog")
20- else:
21- # XXX Ideally the config should be restored to a working state if the
22- # check fails, otherwise an inadvertent reload will cause the service
23- # to be broken.
24- log("HAProxy configuration check failed, exiting.")
25- sys.exit(1)
26
27
28 def start_hook():

Subscribers

People subscribed via source and target branches