Merge lp:~thomir-deactivatedaccount/charm-haproxy/make-config-less-insane into lp:charm-haproxy

Proposed by Thomi Richards on 2017-07-25
Status: Superseded
Proposed branch: lp:~thomir-deactivatedaccount/charm-haproxy/make-config-less-insane
Merge into: lp:charm-haproxy
Diff against target: 59 lines (+20/-12)
2 files modified
files/nrpe/check_haproxy_queue_depth.sh (+2/-2)
hooks/hooks.py (+18/-10)
To merge this branch: bzr merge lp:~thomir-deactivatedaccount/charm-haproxy/make-config-less-insane
Reviewer Review Type Date Requested Status
haproxy-team 2017-07-25 Pending
Review via email: mp+328010@code.launchpad.net

This proposal has been superseded by a proposal from 2017-07-25.

To post a comment you must log in.

Unmerged revisions

119. By Thomi Richards on 2017-07-25

Use <> instead of {} since {} is yaml token for a dictionary.

118. By Thomi Richards on 2017-07-25

Fixed failing test.

117. By Thomi Richards on 2017-07-25

Code cleanups.

116. By Thomi Richards on 2017-07-25

Code cleanups.

115. By Thomi Richards on 2017-07-25

Code cleanups.

114. By Thomi Richards on 2017-07-25

Code cleanups.

113. By Thomi Richards on 2017-07-25

Consolidate two loops.

112. By Thomi Richards on 2017-07-25

Fix service option filtering.

111. By Thomi Richards on 2017-07-25

Hack in a way for users to force an option to a particular section of the config.

110. By William Grant on 2017-05-20

Increase nagios haproxy queue depth thresholds until they're configurable.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'files/nrpe/check_haproxy_queue_depth.sh'
2--- files/nrpe/check_haproxy_queue_depth.sh 2015-05-12 15:10:44 +0000
3+++ files/nrpe/check_haproxy_queue_depth.sh 2017-07-25 07:56:43 +0000
4@@ -7,8 +7,8 @@
5 # Author: Tom Haddon
6
7 # These should be config options at some stage
8-CURRQthrsh=0
9-MAXQthrsh=100
10+CURRQthrsh=10
11+MAXQthrsh=500
12
13 AUTH=$(grep -r "stats auth" /etc/haproxy | head -1 | awk '{print $4}')
14
15
16=== modified file 'hooks/hooks.py'
17--- hooks/hooks.py 2016-11-22 11:15:13 +0000
18+++ hooks/hooks.py 2017-07-25 07:56:43 +0000
19@@ -347,16 +347,24 @@
20 if any(map(o.strip().startswith, service_options)):
21 fe_options.append(o)
22 be_options.append(o)
23+
24 # Filter provided service options into frontend-only and backend-only.
25- results = izip(
26- (fe_options, be_options),
27- (True, False),
28- tee((o, any(map(o.strip().startswith,
29- frontend_only_options)))
30- for o in service_options))
31- for out, cond, result in results:
32- out.extend(option for option, match in result
33- if match is cond and option not in out)
34+ # XXX: The '<FE>' and '<BE>' feature is a local patch in this version
35+ # of the charm, and is not present in the upstream charm.
36+ for option in service_options:
37+ option = option.strip()
38+ if option.startswith('<FE>'):
39+ fe_options.append(option[4:].strip())
40+ elif option.startswith('<BE>'):
41+ be_options.append(option[4:].strip())
42+ else:
43+ if any(map(option.startswith, frontend_only_options)):
44+ if option not in fe_options:
45+ fe_options.append(option)
46+ else:
47+ if option not in be_options:
48+ be_options.append(option)
49+
50 service_config = []
51 unit_name = os.environ["JUJU_UNIT_NAME"].replace("/", "-")
52 service_config.append("frontend %s-%s" % (unit_name, service_port))
53@@ -795,7 +803,7 @@
54 service_name,
55 service_config['service_host'],
56 service_config['service_port'],
57- service_config['service_options'],
58+ service_config.get('service_options', []),
59 server_entries, errorfiles, crts, backends))
60
61

Subscribers

People subscribed via source and target branches

to all changes: