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

Proposed by Andrew Glen-Young on 2014-01-15
Status: Superseded
Proposed branch: lp:~aglenyoung/charms/precise/haproxy/haproxy-stats-socket
Merge into: lp:charms/haproxy
Diff against target: 103 lines (+17/-4)
5 files modified
README.md (+1/-1)
config.yaml (+5/-0)
hooks/hooks.py (+5/-1)
hooks/tests/test_helpers.py (+4/-0)
hooks/tests/test_peer_hooks.py (+2/-2)
To merge this branch: bzr merge lp:~aglenyoung/charms/precise/haproxy/haproxy-stats-socket
Reviewer Review Type Date Requested Status
Marco Ceppi 2014-01-15 Needs Fixing on 2014-01-16
Review via email: mp+201698@code.launchpad.net

This proposal has been superseded by a proposal from 2014-01-16.

To post a comment you must log in.
Marco Ceppi (marcoceppi) wrote :

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
75. By Andrew Glen-Young on 2014-01-16

Fix test linting errors and update README with additional required packages to run the test suite.

76. By Andrew Glen-Young on 2014-01-16

Allow haproxy stats socket to be configured.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README.md'
2--- README.md 2014-01-07 19:03:41 +0000
3+++ README.md 2014-01-16 18:59:58 +0000
4@@ -97,7 +97,7 @@
5 sudo apt-get install python-software-properties
6 sudo add-apt-repository ppa:cjohnston/flake8
7 sudo apt-get update
8- sudo apt-get install python-mock python-flake8 python-nose python-nosexcover
9+ sudo apt-get install python-mock python-flake8 python-nose python-nosexcover python-testtools charm-tools
10
11 To run the tests:
12
13
14=== modified file 'config.yaml'
15--- config.yaml 2014-01-07 18:44:15 +0000
16+++ config.yaml 2014-01-16 18:59:58 +0000
17@@ -34,6 +34,11 @@
18 the same physical server. With the help of this parameter, it becomes
19 possible to add some randomness in the check interval between 0 and
20 +/- 50%. A value between 2 and 5 seems to show good results.
21+ global_stats_socket:
22+ default: False
23+ type: boolean
24+ description: |
25+ Whether to enable the stats UNIX socket.
26 default_log:
27 default: "global"
28 type: string
29
30=== modified file 'hooks/hooks.py'
31--- hooks/hooks.py 2014-01-03 16:01:28 +0000
32+++ hooks/hooks.py 2014-01-16 18:59:58 +0000
33@@ -125,6 +125,9 @@
34 haproxy_globals.append(" quiet")
35 haproxy_globals.append(" spread-checks %d" %
36 config_data['global_spread_checks'])
37+ if config_data['global_stats_socket'] is True:
38+ sock_path = "/var/run/haproxy/haproxy.sock"
39+ haproxy_globals.append(" stats socket %s mode 0600" % sock_path)
40 return '\n'.join(haproxy_globals)
41
42
43@@ -616,7 +619,8 @@
44 "service_%s" % service_name)
45 if not os.path.exists(path):
46 os.makedirs(path)
47- full_path = os.path.join(path, "%s.http" % errorfile["http_status"])
48+ full_path = os.path.join(
49+ path, "%s.http" % errorfile["http_status"])
50 with open(full_path, 'w') as f:
51 f.write(base64.b64decode(errorfile["content"]))
52
53
54=== modified file 'hooks/tests/test_helpers.py'
55--- hooks/tests/test_helpers.py 2013-12-17 16:00:29 +0000
56+++ hooks/tests/test_helpers.py 2014-01-16 18:59:58 +0000
57@@ -23,9 +23,11 @@
58 'global_spread_checks': 234,
59 'global_debug': False,
60 'global_quiet': False,
61+ 'global_stats_socket': True,
62 }
63 result = hooks.create_haproxy_globals()
64
65+ sock_path = "/var/run/haproxy/haproxy.sock"
66 expected = '\n'.join([
67 'global',
68 ' log foo-log',
69@@ -34,6 +36,7 @@
70 ' user foo-user',
71 ' group foo-group',
72 ' spread-checks 234',
73+ ' stats socket %s mode 0600' % sock_path,
74 ])
75 self.assertEqual(result, expected)
76
77@@ -47,6 +50,7 @@
78 'global_spread_checks': 234,
79 'global_debug': True,
80 'global_quiet': True,
81+ 'global_stats_socket': False,
82 }
83 result = hooks.create_haproxy_globals()
84
85
86=== modified file 'hooks/tests/test_peer_hooks.py'
87--- hooks/tests/test_peer_hooks.py 2013-12-17 16:00:29 +0000
88+++ hooks/tests/test_peer_hooks.py 2014-01-16 18:59:58 +0000
89@@ -195,7 +195,8 @@
90 hooks.write_service_config(services_dict)
91
92 create_listen_stanza.assert_called_with(
93- 'bar', 'some-host', 'some-port', 'some-options', (1, 2), [])
94+ 'bar', 'some-host', 'some-port', 'some-options',
95+ (1, 2), [])
96 mock_open.assert_called_with(
97 '/var/run/haproxy/bar.service', 'w')
98 mock_file.write.assert_called_with('some content')
99@@ -231,4 +232,3 @@
100 '/var/lib/haproxy/service_bar/403.http', 'w')
101 mock_file.write.assert_any_call(content)
102 self.assertTrue(create_listen_stanza.called)
103-

Subscribers

People subscribed via source and target branches