Merge lp:~james-page/charms/trusty/rabbitmq-server/network-splits into lp:charms/trusty/rabbitmq-server
- Trusty Tahr (14.04)
- network-splits
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~james-page/charms/trusty/rabbitmq-server/network-splits |
Merge into: | lp:charms/trusty/rabbitmq-server |
Diff against target: |
325 lines (+114/-35) 4 files modified
.coveragerc (+6/-0) hooks/rabbit_utils.py (+38/-0) hooks/rabbitmq_server_relations.py (+64/-33) unit_tests/test_rabbitmq_server_relations.py (+6/-2) |
To merge this branch: | bzr merge lp:~james-page/charms/trusty/rabbitmq-server/network-splits |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Cory Johns (community) | Needs Fixing | ||
Review Queue (community) | automated testing | Needs Fixing | |
James Page | Needs Resubmitting | ||
Tim Van Steenburgh (community) | Needs Fixing | ||
Review via email: mp+228152@code.launchpad.net |
This proposal has been superseded by a proposal from 2015-01-23.
Commit message
Description of the change
Add support for separate 'access-network' configuration.
Tim Van Steenburgh (tvansteenburgh) wrote : | # |
James Page (james-page) wrote : | # |
Hi Tim
https:/
RE the charm proof warning; not touching those - not having a default key is intentional 'unset' being a valid state. The code works on the fact that a config-get on unset keys returns None in JSON.
Cory Johns (johnsca) wrote : | # |
James,
I believe that Tim's point was that the policy was that you still need to provide a default value, even if that value is an empty string. No warnings on `charm proof` is listed on the policy: https:/
Also, my understanding of the "Resubmit" status was that the review was rejected and would need to be resubmitted to be approved; is that not the case?
James Page (james-page) wrote : | # |
charm proof is wrong - sorry I've discussed this numerous times with Marco - not providing a default value is a perfectly acceptable situation and is used extensively in my charms - Marco did at least drop this to a warning rather than an error but I'm not re-writing all of my charms to comply with a policy that I believe is wrong in this case.
James Page (james-page) wrote : | # |
I've raised https:/
James Page (james-page) wrote : | # |
After some discussion with Marco on IRC, he's provided me with a way to have the key, but still leave the default unset; I've updated the charm to reflect this.
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #195 trusty-
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #224 trusty-
UNIT FAIL: unit-test missing
UNIT Results (max last 2 lines):
INFO:root:Search string not found in makefile target commands.
ERROR:root:No make target was executed.
Full unit test output: http://
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #244 trusty-
AMULET FAIL: amulet-test missing
AMULET Results (max last 2 lines):
INFO:root:Search string not found in makefile target commands.
ERROR:root:No make target was executed.
Full amulet test output: http://
Build: http://
Review Queue (review-queue) wrote : | # |
This items has failed automated testing! Results available here http://
Cory Johns (johnsca) wrote : | # |
Test failure is due to a merge conflict, mainly in charmhelpers sync, but there are a couple in the charm itself, as well. I tried my hand at resolving, but there was a bit more than I felt comfortable with making decisions on without deeper knowledge of the charm.
- 72. By James Page
-
Rebase on next branch
- 73. By James Page
-
Optimize calls
- 74. By James Page
-
Re-instate configuration
- 75. By James Page
-
Aligment on config
- 76. By James Page
-
Run flake8 from venv as well
Unmerged revisions
Preview Diff
1 | === added file '.coveragerc' | |||
2 | --- .coveragerc 1970-01-01 00:00:00 +0000 | |||
3 | +++ .coveragerc 2015-01-23 08:23:23 +0000 | |||
4 | @@ -0,0 +1,6 @@ | |||
5 | 1 | [report] | ||
6 | 2 | # Regexes for lines to exclude from consideration | ||
7 | 3 | exclude_lines = | ||
8 | 4 | if __name__ == .__main__.: | ||
9 | 5 | include= | ||
10 | 6 | hooks/rabbit* | ||
11 | 0 | 7 | ||
12 | === modified file 'hooks/rabbit_utils.py' | |||
13 | --- hooks/rabbit_utils.py 2015-01-19 19:02:16 +0000 | |||
14 | +++ hooks/rabbit_utils.py 2015-01-23 08:23:23 +0000 | |||
15 | @@ -37,18 +37,39 @@ | |||
16 | 37 | peer_retrieve | 37 | peer_retrieve |
17 | 38 | ) | 38 | ) |
18 | 39 | 39 | ||
19 | 40 | from collections import OrderedDict | ||
20 | 41 | |||
21 | 40 | PACKAGES = ['rabbitmq-server', 'python-amqplib'] | 42 | PACKAGES = ['rabbitmq-server', 'python-amqplib'] |
22 | 41 | 43 | ||
23 | 42 | RABBITMQ_CTL = '/usr/sbin/rabbitmqctl' | 44 | RABBITMQ_CTL = '/usr/sbin/rabbitmqctl' |
24 | 43 | COOKIE_PATH = '/var/lib/rabbitmq/.erlang.cookie' | 45 | COOKIE_PATH = '/var/lib/rabbitmq/.erlang.cookie' |
25 | 44 | ENV_CONF = '/etc/rabbitmq/rabbitmq-env.conf' | 46 | ENV_CONF = '/etc/rabbitmq/rabbitmq-env.conf' |
26 | 45 | RABBITMQ_CONF = '/etc/rabbitmq/rabbitmq.config' | 47 | RABBITMQ_CONF = '/etc/rabbitmq/rabbitmq.config' |
27 | 48 | ENABLED_PLUGINS = '/etc/rabbitmq/enabled_plugins' | ||
28 | 46 | RABBIT_USER = 'rabbitmq' | 49 | RABBIT_USER = 'rabbitmq' |
29 | 47 | LIB_PATH = '/var/lib/rabbitmq/' | 50 | LIB_PATH = '/var/lib/rabbitmq/' |
30 | 48 | HOSTS_FILE = '/etc/hosts' | 51 | HOSTS_FILE = '/etc/hosts' |
31 | 49 | 52 | ||
32 | 50 | _named_passwd = '/var/lib/charm/{}/{}.passwd' | 53 | _named_passwd = '/var/lib/charm/{}/{}.passwd' |
33 | 51 | 54 | ||
34 | 55 | # hook_contexts are used as a convenient mechanism to render templates | ||
35 | 56 | # logically, consider building a hook_context for template rendering so | ||
36 | 57 | # the charm doesn't concern itself with template specifics etc. | ||
37 | 58 | CONFIG_FILES = OrderedDict([ | ||
38 | 59 | (RABBITMQ_CONF, { | ||
39 | 60 | 'hook_contexts': None, | ||
40 | 61 | 'services': ['rabbitmq-server'] | ||
41 | 62 | }), | ||
42 | 63 | (ENV_CONF, { | ||
43 | 64 | 'hook_contexts': None, | ||
44 | 65 | 'services': ['rabbitmq-server'] | ||
45 | 66 | }), | ||
46 | 67 | (ENABLED_PLUGINS, { | ||
47 | 68 | 'hook_contexts': None, | ||
48 | 69 | 'services': ['rabbitmq-server'] | ||
49 | 70 | }), | ||
50 | 71 | ]) | ||
51 | 72 | |||
52 | 52 | 73 | ||
53 | 53 | class RabbitmqError(Exception): | 74 | class RabbitmqError(Exception): |
54 | 54 | pass | 75 | pass |
55 | @@ -532,3 +553,20 @@ | |||
56 | 532 | if lsb_release()['DISTRIB_CODENAME'].lower() < "trusty": | 553 | if lsb_release()['DISTRIB_CODENAME'].lower() < "trusty": |
57 | 533 | raise Exception("IPv6 is not supported in the charms for Ubuntu " | 554 | raise Exception("IPv6 is not supported in the charms for Ubuntu " |
58 | 534 | "versions less than Trusty 14.04") | 555 | "versions less than Trusty 14.04") |
59 | 556 | |||
60 | 557 | |||
61 | 558 | def restart_map(): | ||
62 | 559 | '''Determine the correct resource map to be passed to | ||
63 | 560 | charmhelpers.core.restart_on_change() based on the services configured. | ||
64 | 561 | |||
65 | 562 | :returns: dict: A dictionary mapping config file to lists of services | ||
66 | 563 | that should be restarted when file changes. | ||
67 | 564 | ''' | ||
68 | 565 | _map = [] | ||
69 | 566 | for f, ctxt in CONFIG_FILES.iteritems(): | ||
70 | 567 | svcs = [] | ||
71 | 568 | for svc in ctxt['services']: | ||
72 | 569 | svcs.append(svc) | ||
73 | 570 | if svcs: | ||
74 | 571 | _map.append((f, svcs)) | ||
75 | 572 | return OrderedDict(_map) | ||
76 | 535 | 573 | ||
77 | === modified file 'hooks/rabbitmq_server_relations.py' | |||
78 | --- hooks/rabbitmq_server_relations.py 2015-01-12 21:16:00 +0000 | |||
79 | +++ hooks/rabbitmq_server_relations.py 2015-01-23 08:23:23 +0000 | |||
80 | @@ -31,11 +31,15 @@ | |||
81 | 31 | from charmhelpers.fetch import ( | 31 | from charmhelpers.fetch import ( |
82 | 32 | add_source, | 32 | add_source, |
83 | 33 | apt_update, | 33 | apt_update, |
85 | 34 | apt_install) | 34 | apt_install, |
86 | 35 | ) | ||
87 | 35 | 36 | ||
88 | 36 | from charmhelpers.core.hookenv import ( | 37 | from charmhelpers.core.hookenv import ( |
91 | 37 | open_port, close_port, | 38 | open_port, |
92 | 38 | log, ERROR, | 39 | close_port, |
93 | 40 | log, | ||
94 | 41 | ERROR, | ||
95 | 42 | INFO, | ||
96 | 39 | relation_get, | 43 | relation_get, |
97 | 40 | relation_set, | 44 | relation_set, |
98 | 41 | relation_ids, | 45 | relation_ids, |
99 | @@ -50,7 +54,11 @@ | |||
100 | 50 | UnregisteredHookError | 54 | UnregisteredHookError |
101 | 51 | ) | 55 | ) |
102 | 52 | from charmhelpers.core.host import ( | 56 | from charmhelpers.core.host import ( |
104 | 53 | rsync, service_stop, service_restart, cmp_pkgrevno | 57 | cmp_pkgrevno, |
105 | 58 | restart_on_change, | ||
106 | 59 | rsync, | ||
107 | 60 | service_stop, | ||
108 | 61 | service_restart, | ||
109 | 54 | ) | 62 | ) |
110 | 55 | from charmhelpers.contrib.charmsupport.nrpe import NRPE | 63 | from charmhelpers.contrib.charmsupport.nrpe import NRPE |
111 | 56 | from charmhelpers.contrib.ssl.service import ServiceCA | 64 | from charmhelpers.contrib.ssl.service import ServiceCA |
112 | @@ -63,6 +71,8 @@ | |||
113 | 63 | peer_retrieve_by_prefix, | 71 | peer_retrieve_by_prefix, |
114 | 64 | ) | 72 | ) |
115 | 65 | 73 | ||
116 | 74 | from charmhelpers.contrib.network.ip import get_address_in_network | ||
117 | 75 | |||
118 | 66 | hooks = Hooks() | 76 | hooks = Hooks() |
119 | 67 | 77 | ||
120 | 68 | SERVICE_NAME = os.getenv('JUJU_UNIT_NAME').split('/')[0] | 78 | SERVICE_NAME = os.getenv('JUJU_UNIT_NAME').split('/')[0] |
121 | @@ -150,7 +160,16 @@ | |||
122 | 150 | if config('prefer-ipv6'): | 160 | if config('prefer-ipv6'): |
123 | 151 | relation_settings['private-address'] = get_ipv6_addr()[0] | 161 | relation_settings['private-address'] = get_ipv6_addr()[0] |
124 | 152 | else: | 162 | else: |
126 | 153 | relation_settings['hostname'] = unit_get('private-address') | 163 | # NOTE(jamespage) |
127 | 164 | # override private-address settings if access-network is | ||
128 | 165 | # configured and an appropriate network interface is configured. | ||
129 | 166 | relation_settings['hostname'] = \ | ||
130 | 167 | get_address_in_network(config('access-network'), | ||
131 | 168 | unit_get('private-address')) | ||
132 | 169 | relation_settings['private-address'] = \ | ||
133 | 170 | get_address_in_network(config('access-network'), | ||
134 | 171 | unit_get('private-address')) | ||
135 | 172 | |||
136 | 154 | 173 | ||
137 | 155 | configure_client_ssl(relation_settings) | 174 | configure_client_ssl(relation_settings) |
138 | 156 | 175 | ||
139 | @@ -167,6 +186,7 @@ | |||
140 | 167 | # set if need HA queues or not | 186 | # set if need HA queues or not |
141 | 168 | if cmp_pkgrevno('rabbitmq-server', '3.0.1') < 0: | 187 | if cmp_pkgrevno('rabbitmq-server', '3.0.1') < 0: |
142 | 169 | relation_settings['ha_queues'] = True | 188 | relation_settings['ha_queues'] = True |
143 | 189 | |||
144 | 170 | peer_store_and_set(relation_id=relation_id, | 190 | peer_store_and_set(relation_id=relation_id, |
145 | 171 | relation_settings=relation_settings) | 191 | relation_settings=relation_settings) |
146 | 172 | 192 | ||
147 | @@ -200,9 +220,10 @@ | |||
148 | 200 | # then use the current hostname | 220 | # then use the current hostname |
149 | 201 | nodename = socket.gethostname() | 221 | nodename = socket.gethostname() |
150 | 202 | 222 | ||
152 | 203 | if nodename: | 223 | if nodename and rabbit.get_node_name() != nodename: |
153 | 204 | log('forcing nodename=%s' % nodename) | 224 | log('forcing nodename=%s' % nodename) |
155 | 205 | # need to stop it under current nodename | 225 | # would like to have used the restart_on_change decorator, but |
156 | 226 | # need to stop it under current nodename prior to updating env | ||
157 | 206 | service_stop('rabbitmq-server') | 227 | service_stop('rabbitmq-server') |
158 | 207 | rabbit.update_rmq_env_conf(hostname='rabbit@%s' % nodename, | 228 | rabbit.update_rmq_env_conf(hostname='rabbit@%s' % nodename, |
159 | 208 | ipv6=config('prefer-ipv6')) | 229 | ipv6=config('prefer-ipv6')) |
160 | @@ -212,7 +233,6 @@ | |||
161 | 212 | log('cluster_joined: Relation greater.') | 233 | log('cluster_joined: Relation greater.') |
162 | 213 | return | 234 | return |
163 | 214 | 235 | ||
164 | 215 | rabbit.COOKIE_PATH = '/var/lib/rabbitmq/.erlang.cookie' | ||
165 | 216 | if not os.path.isfile(rabbit.COOKIE_PATH): | 236 | if not os.path.isfile(rabbit.COOKIE_PATH): |
166 | 217 | log('erlang cookie missing from %s' % rabbit.COOKIE_PATH, | 237 | log('erlang cookie missing from %s' % rabbit.COOKIE_PATH, |
167 | 218 | level=ERROR) | 238 | level=ERROR) |
168 | @@ -225,7 +245,7 @@ | |||
169 | 225 | def cluster_changed(): | 245 | def cluster_changed(): |
170 | 226 | rdata = relation_get() | 246 | rdata = relation_get() |
171 | 227 | if 'cookie' not in rdata: | 247 | if 'cookie' not in rdata: |
173 | 228 | log('cluster_joined: cookie not yet set.') | 248 | log('cluster_joined: cookie not yet set.', level=INFO) |
174 | 229 | return | 249 | return |
175 | 230 | 250 | ||
176 | 231 | if config('prefer-ipv6') and rdata.get('hostname'): | 251 | if config('prefer-ipv6') and rdata.get('hostname'): |
177 | @@ -239,21 +259,13 @@ | |||
178 | 239 | whitelist = [a for a in rdata.keys() if a not in blacklist] | 259 | whitelist = [a for a in rdata.keys() if a not in blacklist] |
179 | 240 | peer_echo(includes=whitelist) | 260 | peer_echo(includes=whitelist) |
180 | 241 | 261 | ||
191 | 242 | # sync cookie | 262 | # sync the cookie with peers if necessary |
192 | 243 | cookie = peer_retrieve('cookie') | 263 | update_cookie() |
183 | 244 | if open(rabbit.COOKIE_PATH, 'r').read().strip() == cookie: | ||
184 | 245 | log('Cookie already synchronized with peer.') | ||
185 | 246 | else: | ||
186 | 247 | log('Synchronizing erlang cookie from peer.') | ||
187 | 248 | rabbit.service('stop') | ||
188 | 249 | with open(rabbit.COOKIE_PATH, 'wb') as out: | ||
189 | 250 | out.write(cookie) | ||
190 | 251 | rabbit.service('start') | ||
193 | 252 | 264 | ||
194 | 253 | if is_relation_made('ha') and \ | 265 | if is_relation_made('ha') and \ |
195 | 254 | config('ha-vip-only') is False: | 266 | config('ha-vip-only') is False: |
196 | 255 | log('hacluster relation is present, skipping native ' | 267 | log('hacluster relation is present, skipping native ' |
198 | 256 | 'rabbitmq cluster config.') | 268 | 'rabbitmq cluster config.', level=INFO) |
199 | 257 | return | 269 | return |
200 | 258 | 270 | ||
201 | 259 | # cluster with node | 271 | # cluster with node |
202 | @@ -268,6 +280,24 @@ | |||
203 | 268 | amqp_changed(relation_id=rid, remote_unit=unit) | 280 | amqp_changed(relation_id=rid, remote_unit=unit) |
204 | 269 | 281 | ||
205 | 270 | 282 | ||
206 | 283 | def update_cookie(): | ||
207 | 284 | # sync cookie | ||
208 | 285 | cookie = peer_retrieve('cookie') | ||
209 | 286 | cookie_local = None | ||
210 | 287 | with open(rabbit.COOKIE_PATH, 'r') as f: | ||
211 | 288 | cookie_local = f.read().strip() | ||
212 | 289 | |||
213 | 290 | if cookie_local == cookie: | ||
214 | 291 | log('Cookie already synchronized with peer.') | ||
215 | 292 | return | ||
216 | 293 | |||
217 | 294 | log('Synchronizing erlang cookie from peer.', level=INFO) | ||
218 | 295 | service_stop('rabbitmq-server') | ||
219 | 296 | with open(rabbit.COOKIE_PATH, 'wb') as out: | ||
220 | 297 | out.write(cookie) | ||
221 | 298 | service_restart('rabbitmq-server') | ||
222 | 299 | |||
223 | 300 | |||
224 | 271 | @hooks.hook('cluster-relation-departed') | 301 | @hooks.hook('cluster-relation-departed') |
225 | 272 | def cluster_departed(): | 302 | def cluster_departed(): |
226 | 273 | if is_relation_made('ha') and \ | 303 | if is_relation_made('ha') and \ |
227 | @@ -407,13 +437,13 @@ | |||
228 | 407 | rbd_size = config('rbd-size') | 437 | rbd_size = config('rbd-size') |
229 | 408 | sizemb = int(rbd_size.split('G')[0]) * 1024 | 438 | sizemb = int(rbd_size.split('G')[0]) * 1024 |
230 | 409 | blk_device = '/dev/rbd/%s/%s' % (POOL_NAME, rbd_img) | 439 | blk_device = '/dev/rbd/%s/%s' % (POOL_NAME, rbd_img) |
232 | 410 | # rbd_pool_rep_count = config('ceph-osd-replication-count') | 440 | ceph.create_pool(service=SERVICE_NAME, name=POOL_NAME, |
233 | 441 | replicas=int(config('ceph-osd-replication-count'))) | ||
234 | 411 | ceph.ensure_ceph_storage(service=SERVICE_NAME, pool=POOL_NAME, | 442 | ceph.ensure_ceph_storage(service=SERVICE_NAME, pool=POOL_NAME, |
235 | 412 | rbd_img=rbd_img, sizemb=sizemb, | 443 | rbd_img=rbd_img, sizemb=sizemb, |
236 | 413 | fstype='ext4', mount_point=RABBIT_DIR, | 444 | fstype='ext4', mount_point=RABBIT_DIR, |
237 | 414 | blk_device=blk_device, | 445 | blk_device=blk_device, |
240 | 415 | system_services=['rabbitmq-server']) # , | 446 | system_services=['rabbitmq-server']) |
239 | 416 | # rbd_pool_replicas=rbd_pool_rep_count) | ||
241 | 417 | subprocess.check_call(['chown', '-R', '%s:%s' % | 447 | subprocess.check_call(['chown', '-R', '%s:%s' % |
242 | 418 | (RABBIT_USER, RABBIT_GROUP), RABBIT_DIR]) | 448 | (RABBIT_USER, RABBIT_GROUP), RABBIT_DIR]) |
243 | 419 | else: | 449 | else: |
244 | @@ -595,12 +625,8 @@ | |||
245 | 595 | open_port(ssl_port) | 625 | open_port(ssl_port) |
246 | 596 | 626 | ||
247 | 597 | 627 | ||
248 | 598 | def restart_rabbit_update_nrpe(): | ||
249 | 599 | service_restart('rabbitmq-server') | ||
250 | 600 | update_nrpe_checks() | ||
251 | 601 | |||
252 | 602 | |||
253 | 603 | @hooks.hook('config-changed') | 628 | @hooks.hook('config-changed') |
254 | 629 | @restart_on_change(rabbit.restart_map()) | ||
255 | 604 | def config_changed(): | 630 | def config_changed(): |
256 | 605 | if config('prefer-ipv6'): | 631 | if config('prefer-ipv6'): |
257 | 606 | rabbit.assert_charm_supports_ipv6() | 632 | rabbit.assert_charm_supports_ipv6() |
258 | @@ -622,9 +648,7 @@ | |||
259 | 622 | chmod(RABBIT_DIR, 0o775) | 648 | chmod(RABBIT_DIR, 0o775) |
260 | 623 | 649 | ||
261 | 624 | if config('prefer-ipv6'): | 650 | if config('prefer-ipv6'): |
262 | 625 | service_stop('rabbitmq-server') | ||
263 | 626 | rabbit.update_rmq_env_conf(ipv6=config('prefer-ipv6')) | 651 | rabbit.update_rmq_env_conf(ipv6=config('prefer-ipv6')) |
264 | 627 | service_restart('rabbitmq-server') | ||
265 | 628 | 652 | ||
266 | 629 | if config('management_plugin') is True: | 653 | if config('management_plugin') is True: |
267 | 630 | rabbit.enable_plugin(MAN_PLUGIN) | 654 | rabbit.enable_plugin(MAN_PLUGIN) |
268 | @@ -641,15 +665,22 @@ | |||
269 | 641 | ha_is_active_active = config("ha-vip-only") | 665 | ha_is_active_active = config("ha-vip-only") |
270 | 642 | 666 | ||
271 | 643 | if ha_is_active_active: | 667 | if ha_is_active_active: |
273 | 644 | restart_rabbit_update_nrpe() | 668 | update_nrpe_checks() |
274 | 645 | else: | 669 | else: |
275 | 646 | if is_elected_leader('res_rabbitmq_vip'): | 670 | if is_elected_leader('res_rabbitmq_vip'): |
277 | 647 | restart_rabbit_update_nrpe() | 671 | update_nrpe_checks() |
278 | 648 | else: | 672 | else: |
279 | 649 | log("hacluster relation is present but this node is not active" | 673 | log("hacluster relation is present but this node is not active" |
280 | 650 | " skipping update nrpe checks") | 674 | " skipping update nrpe checks") |
281 | 651 | else: | 675 | else: |
283 | 652 | restart_rabbit_update_nrpe() | 676 | update_nrpe_checks() |
284 | 677 | |||
285 | 678 | # NOTE(jamespage) | ||
286 | 679 | # trigger amqp_changed to pickup and changes to network | ||
287 | 680 | # configuration via the access-network config option. | ||
288 | 681 | for rid in relation_ids('amqp'): | ||
289 | 682 | for unit in related_units(rid): | ||
290 | 683 | amqp_changed(relation_id=rid, remote_unit=unit) | ||
291 | 653 | 684 | ||
292 | 654 | 685 | ||
293 | 655 | def pre_install_hooks(): | 686 | def pre_install_hooks(): |
294 | 656 | 687 | ||
295 | === modified file 'unit_tests/test_rabbitmq_server_relations.py' | |||
296 | --- unit_tests/test_rabbitmq_server_relations.py 2014-11-27 10:52:50 +0000 | |||
297 | +++ unit_tests/test_rabbitmq_server_relations.py 2015-01-23 08:23:23 +0000 | |||
298 | @@ -69,14 +69,16 @@ | |||
299 | 69 | self.fake_repo = {'rabbitmq-server': {'pkg_vers': '3.0'}} | 69 | self.fake_repo = {'rabbitmq-server': {'pkg_vers': '3.0'}} |
300 | 70 | rabbitmq_server_relations.amqp_changed(None, None) | 70 | rabbitmq_server_relations.amqp_changed(None, None) |
301 | 71 | mock_peer_store_and_set.assert_called_with( | 71 | mock_peer_store_and_set.assert_called_with( |
303 | 72 | relation_settings={'hostname': host_addr, | 72 | relation_settings={'private-address': '10.1.2.3', |
304 | 73 | 'hostname': host_addr, | ||
305 | 73 | 'ha_queues': True}, | 74 | 'ha_queues': True}, |
306 | 74 | relation_id=None) | 75 | relation_id=None) |
307 | 75 | 76 | ||
308 | 76 | self.fake_repo = {'rabbitmq-server': {'pkg_vers': '3.0.2'}} | 77 | self.fake_repo = {'rabbitmq-server': {'pkg_vers': '3.0.2'}} |
309 | 77 | rabbitmq_server_relations.amqp_changed(None, None) | 78 | rabbitmq_server_relations.amqp_changed(None, None) |
310 | 78 | mock_peer_store_and_set.assert_called_with( | 79 | mock_peer_store_and_set.assert_called_with( |
312 | 79 | relation_settings={'hostname': host_addr}, | 80 | relation_settings={'private-address': '10.1.2.3', |
313 | 81 | 'hostname': host_addr}, | ||
314 | 80 | relation_id=None) | 82 | relation_id=None) |
315 | 81 | 83 | ||
316 | 82 | @patch('rabbitmq_server_relations.peer_store_and_set') | 84 | @patch('rabbitmq_server_relations.peer_store_and_set') |
317 | @@ -108,6 +110,8 @@ | |||
318 | 108 | mock_config.side_effect = config | 110 | mock_config.side_effect = config |
319 | 109 | ipv6_addr = "2001:db8:1:0:f816:3eff:fed6:c140" | 111 | ipv6_addr = "2001:db8:1:0:f816:3eff:fed6:c140" |
320 | 110 | mock_get_ipv6_addr.return_value = [ipv6_addr] | 112 | mock_get_ipv6_addr.return_value = [ipv6_addr] |
321 | 113 | host_addr = "10.1.2.3" | ||
322 | 114 | unit_get.return_value = host_addr | ||
323 | 111 | is_elected_leader.return_value = True | 115 | is_elected_leader.return_value = True |
324 | 112 | relation_get.return_value = {} | 116 | relation_get.return_value = {} |
325 | 113 | is_clustered.return_value = False | 117 | is_clustered.return_value = False |
Hi James,
Thanks for this. Code review looks good, but I'm unsure how to do a functional test of this, can you provide instructions?
Also, there are some charm-proof warnings to clean up:
W: config.yaml: option access-network does not have the keys: default
W: config.yaml: option key does not have the keys: default
W: config.yaml: option source does not have the keys: default
Thanks!