Merge lp:~aglenyoung/charms/precise/haproxy/haproxy-stats-socket into lp:charms/haproxy

Proposed by Andrew Glen-Young
Status: Merged
Merged at revision: 83
Proposed branch: lp:~aglenyoung/charms/precise/haproxy/haproxy-stats-socket
Merge into: lp:charms/haproxy
Prerequisite: lp:~aglenyoung/charms/precise/haproxy/haproxy-fix-tests
Diff against target: 60 lines (+12/-0)
3 files modified
config.yaml (+5/-0)
hooks/hooks.py (+3/-0)
hooks/tests/test_helpers.py (+4/-0)
To merge this branch: bzr merge lp:~aglenyoung/charms/precise/haproxy/haproxy-stats-socket
Reviewer Review Type Date Requested Status
Tim Van Steenburgh (community) Approve
Marco Ceppi Pending
Review via email: mp+201980@code.launchpad.net

This proposal supersedes a proposal from 2014-01-15.

To post a comment you must log in.
Revision history for this message
Marco Ceppi (marcoceppi) wrote : Posted in a previous version of this proposal

Hi Andrew, thanks for taking the time to add this option! Unfortunately your changes do not pass the haproxy unit test.

You can verify this by running `make build` in the charm's root. Please update the tests to reflect your changes.

Barring the tests passing, this LGTM. However, because of the test fails I have to decline this merge. Once you've addressed this issue please select "Request another review" and enter "charmers". This will place your update back in our charm review queue so we can re-review it again.

review: Needs Fixing
Revision history for this message
Andrew Glen-Young (aglenyoung) wrote :

I've added a prerequisite branch which cleans up the tests a little before submitting my branch.

The functionality stays the same but I've done the following:
- Updated the config variable name to be consistent with the current convention.
- Added the required tests.

Revision history for this message
Tim Van Steenburgh (tvansteenburgh) wrote :

+1 LGTM.

This still fails charm-proof and `make test`, but I've pushed a MP that fixes that: https://code.launchpad.net/~tvansteenburgh/charms/precise/haproxy/fix-proof-and-tests/+merge/233784

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'config.yaml'
2--- config.yaml 2014-01-07 18:44:15 +0000
3+++ config.yaml 2014-01-16 19:00:01 +0000
4@@ -34,6 +34,11 @@
5 the same physical server. With the help of this parameter, it becomes
6 possible to add some randomness in the check interval between 0 and
7 +/- 50%. A value between 2 and 5 seems to show good results.
8+ global_stats_socket:
9+ default: False
10+ type: boolean
11+ description: |
12+ Whether to enable the stats UNIX socket.
13 default_log:
14 default: "global"
15 type: string
16
17=== modified file 'hooks/hooks.py'
18--- hooks/hooks.py 2014-01-16 19:00:01 +0000
19+++ hooks/hooks.py 2014-01-16 19:00:01 +0000
20@@ -125,6 +125,9 @@
21 haproxy_globals.append(" quiet")
22 haproxy_globals.append(" spread-checks %d" %
23 config_data['global_spread_checks'])
24+ if config_data['global_stats_socket'] is True:
25+ sock_path = "/var/run/haproxy/haproxy.sock"
26+ haproxy_globals.append(" stats socket %s mode 0600" % sock_path)
27 return '\n'.join(haproxy_globals)
28
29
30
31=== modified file 'hooks/tests/test_helpers.py'
32--- hooks/tests/test_helpers.py 2013-12-17 16:00:29 +0000
33+++ hooks/tests/test_helpers.py 2014-01-16 19:00:01 +0000
34@@ -23,9 +23,11 @@
35 'global_spread_checks': 234,
36 'global_debug': False,
37 'global_quiet': False,
38+ 'global_stats_socket': True,
39 }
40 result = hooks.create_haproxy_globals()
41
42+ sock_path = "/var/run/haproxy/haproxy.sock"
43 expected = '\n'.join([
44 'global',
45 ' log foo-log',
46@@ -34,6 +36,7 @@
47 ' user foo-user',
48 ' group foo-group',
49 ' spread-checks 234',
50+ ' stats socket %s mode 0600' % sock_path,
51 ])
52 self.assertEqual(result, expected)
53
54@@ -47,6 +50,7 @@
55 'global_spread_checks': 234,
56 'global_debug': True,
57 'global_quiet': True,
58+ 'global_stats_socket': False,
59 }
60 result = hooks.create_haproxy_globals()
61

Subscribers

People subscribed via source and target branches