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

Proposed by Andrew Glen-Young
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 (community) Needs Fixing
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.
Revision history for this message
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

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

76. By Andrew Glen-Young

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
=== modified file 'README.md'
--- README.md 2014-01-07 19:03:41 +0000
+++ README.md 2014-01-16 18:59:58 +0000
@@ -97,7 +97,7 @@
97 sudo apt-get install python-software-properties97 sudo apt-get install python-software-properties
98 sudo add-apt-repository ppa:cjohnston/flake898 sudo add-apt-repository ppa:cjohnston/flake8
99 sudo apt-get update99 sudo apt-get update
100 sudo apt-get install python-mock python-flake8 python-nose python-nosexcover100 sudo apt-get install python-mock python-flake8 python-nose python-nosexcover python-testtools charm-tools
101101
102To run the tests:102To run the tests:
103103
104104
=== modified file 'config.yaml'
--- config.yaml 2014-01-07 18:44:15 +0000
+++ config.yaml 2014-01-16 18:59:58 +0000
@@ -34,6 +34,11 @@
34 the same physical server. With the help of this parameter, it becomes 34 the same physical server. With the help of this parameter, it becomes
35 possible to add some randomness in the check interval between 0 and 35 possible to add some randomness in the check interval between 0 and
36 +/- 50%. A value between 2 and 5 seems to show good results.36 +/- 50%. A value between 2 and 5 seems to show good results.
37 global_stats_socket:
38 default: False
39 type: boolean
40 description: |
41 Whether to enable the stats UNIX socket.
37 default_log:42 default_log:
38 default: "global"43 default: "global"
39 type: string44 type: string
4045
=== modified file 'hooks/hooks.py'
--- hooks/hooks.py 2014-01-03 16:01:28 +0000
+++ hooks/hooks.py 2014-01-16 18:59:58 +0000
@@ -125,6 +125,9 @@
125 haproxy_globals.append(" quiet")125 haproxy_globals.append(" quiet")
126 haproxy_globals.append(" spread-checks %d" %126 haproxy_globals.append(" spread-checks %d" %
127 config_data['global_spread_checks'])127 config_data['global_spread_checks'])
128 if config_data['global_stats_socket'] is True:
129 sock_path = "/var/run/haproxy/haproxy.sock"
130 haproxy_globals.append(" stats socket %s mode 0600" % sock_path)
128 return '\n'.join(haproxy_globals)131 return '\n'.join(haproxy_globals)
129132
130133
@@ -616,7 +619,8 @@
616 "service_%s" % service_name)619 "service_%s" % service_name)
617 if not os.path.exists(path):620 if not os.path.exists(path):
618 os.makedirs(path)621 os.makedirs(path)
619 full_path = os.path.join(path, "%s.http" % errorfile["http_status"])622 full_path = os.path.join(
623 path, "%s.http" % errorfile["http_status"])
620 with open(full_path, 'w') as f:624 with open(full_path, 'w') as f:
621 f.write(base64.b64decode(errorfile["content"]))625 f.write(base64.b64decode(errorfile["content"]))
622626
623627
=== modified file 'hooks/tests/test_helpers.py'
--- hooks/tests/test_helpers.py 2013-12-17 16:00:29 +0000
+++ hooks/tests/test_helpers.py 2014-01-16 18:59:58 +0000
@@ -23,9 +23,11 @@
23 'global_spread_checks': 234,23 'global_spread_checks': 234,
24 'global_debug': False,24 'global_debug': False,
25 'global_quiet': False,25 'global_quiet': False,
26 'global_stats_socket': True,
26 }27 }
27 result = hooks.create_haproxy_globals()28 result = hooks.create_haproxy_globals()
2829
30 sock_path = "/var/run/haproxy/haproxy.sock"
29 expected = '\n'.join([31 expected = '\n'.join([
30 'global',32 'global',
31 ' log foo-log',33 ' log foo-log',
@@ -34,6 +36,7 @@
34 ' user foo-user',36 ' user foo-user',
35 ' group foo-group',37 ' group foo-group',
36 ' spread-checks 234',38 ' spread-checks 234',
39 ' stats socket %s mode 0600' % sock_path,
37 ])40 ])
38 self.assertEqual(result, expected)41 self.assertEqual(result, expected)
3942
@@ -47,6 +50,7 @@
47 'global_spread_checks': 234,50 'global_spread_checks': 234,
48 'global_debug': True,51 'global_debug': True,
49 'global_quiet': True,52 'global_quiet': True,
53 'global_stats_socket': False,
50 }54 }
51 result = hooks.create_haproxy_globals()55 result = hooks.create_haproxy_globals()
5256
5357
=== modified file 'hooks/tests/test_peer_hooks.py'
--- hooks/tests/test_peer_hooks.py 2013-12-17 16:00:29 +0000
+++ hooks/tests/test_peer_hooks.py 2014-01-16 18:59:58 +0000
@@ -195,7 +195,8 @@
195 hooks.write_service_config(services_dict)195 hooks.write_service_config(services_dict)
196196
197 create_listen_stanza.assert_called_with(197 create_listen_stanza.assert_called_with(
198 'bar', 'some-host', 'some-port', 'some-options', (1, 2), [])198 'bar', 'some-host', 'some-port', 'some-options',
199 (1, 2), [])
199 mock_open.assert_called_with(200 mock_open.assert_called_with(
200 '/var/run/haproxy/bar.service', 'w')201 '/var/run/haproxy/bar.service', 'w')
201 mock_file.write.assert_called_with('some content')202 mock_file.write.assert_called_with('some content')
@@ -231,4 +232,3 @@
231 '/var/lib/haproxy/service_bar/403.http', 'w')232 '/var/lib/haproxy/service_bar/403.http', 'w')
232 mock_file.write.assert_any_call(content)233 mock_file.write.assert_any_call(content)
233 self.assertTrue(create_listen_stanza.called)234 self.assertTrue(create_listen_stanza.called)
234

Subscribers

People subscribed via source and target branches