Merge lp:~niedbalski/charms/trusty/rabbitmq-server/stable-backport-1489053 into lp:charms/trusty/rabbitmq-server

Proposed by Jorge Niedbalski
Status: Merged
Merged at revision: 104
Proposed branch: lp:~niedbalski/charms/trusty/rabbitmq-server/stable-backport-1489053
Merge into: lp:charms/trusty/rabbitmq-server
Diff against target: 97 lines (+27/-20)
3 files modified
hooks/charmhelpers/contrib/network/ip.py (+5/-1)
hooks/rabbit_utils.py (+4/-11)
hooks/rabbitmq_server_relations.py (+18/-8)
To merge this branch: bzr merge lp:~niedbalski/charms/trusty/rabbitmq-server/stable-backport-1489053
Reviewer Review Type Date Requested Status
Jorge Niedbalski (community) Approve
Billy Olsen Approve
Review via email: mp+272170@code.launchpad.net

Description of the change

Backport of fix for LP: #1489053

To post a comment you must log in.
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #10580 rabbitmq-server for niedbalski mp272170
    LINT FAIL: lint-test failed
    LINT FAIL: charm-proof failed

LINT Results (max last 2 lines):
make: *** [lint] Error 100
ERROR:root:Make target returned non-zero.

Full lint test output: http://paste.ubuntu.com/12534576/
Build: http://10.245.162.77:8080/job/charm_lint_check/10580/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #9768 rabbitmq-server for niedbalski mp272170
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/9768/

Revision history for this message
Billy Olsen (billy-olsen) wrote :

Changes LGTM - I'm awaiting the rest of OSCI's tests then I'll merge

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #6714 rabbitmq-server for niedbalski mp272170
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/6714/

Revision history for this message
Billy Olsen (billy-olsen) wrote :

LGTM, Approved!

review: Approve
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #10681 rabbitmq-server for niedbalski mp272170
    LINT FAIL: lint-test failed
    LINT FAIL: charm-proof failed

LINT Results (max last 2 lines):
make: *** [lint] Error 100
ERROR:root:Make target returned non-zero.

Full lint test output: http://paste.ubuntu.com/12543376/
Build: http://10.245.162.77:8080/job/charm_lint_check/10681/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #9863 rabbitmq-server for niedbalski mp272170
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/9863/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #6720 rabbitmq-server for niedbalski mp272170
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/6720/

Revision history for this message
Jorge Niedbalski (niedbalski) :
review: Approve
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #10698 rabbitmq-server for niedbalski mp272170
    LINT FAIL: lint-test failed
    LINT FAIL: charm-proof failed

LINT Results (max last 2 lines):
make: *** [lint] Error 100
ERROR:root:Make target returned non-zero.

Full lint test output: http://paste.ubuntu.com/12545759/
Build: http://10.245.162.77:8080/job/charm_lint_check/10698/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/charmhelpers/contrib/network/ip.py'
2--- hooks/charmhelpers/contrib/network/ip.py 2015-09-23 12:04:43 +0000
3+++ hooks/charmhelpers/contrib/network/ip.py 2015-09-23 19:38:09 +0000
4@@ -437,8 +437,12 @@
5
6 rev = dns.reversename.from_address(address)
7 result = ns_query(rev)
8+
9 if not result:
10- return None
11+ try:
12+ result = socket.gethostbyaddr(address)[0]
13+ except:
14+ return None
15 else:
16 result = address
17
18
19=== modified file 'hooks/rabbit_utils.py'
20--- hooks/rabbit_utils.py 2015-09-10 16:16:02 +0000
21+++ hooks/rabbit_utils.py 2015-09-23 19:38:09 +0000
22@@ -2,7 +2,6 @@
23 import pwd
24 import grp
25 import re
26-import socket
27 import sys
28 import subprocess
29 import glob
30@@ -270,18 +269,12 @@
31 address = relation_get('private-address',
32 rid=r_id, unit=unit)
33 if address is not None:
34- try:
35- node = get_hostname(address, fqdn=False)
36- except:
37+ node = get_hostname(address, fqdn=False)
38+ if node:
39+ available_nodes.append(node)
40+ else:
41 log('Cannot resolve hostname for {} '
42 'using DNS servers'.format(address), level='WARNING')
43- log('Falling back to use socket.gethostname()',
44- level='WARNING')
45- # If the private-address is not resolvable using DNS
46- # then use the current hostname
47- node = socket.gethostname()
48-
49- available_nodes.append(node)
50
51 if len(available_nodes) == 0:
52 log('No nodes available to cluster with')
53
54=== modified file 'hooks/rabbitmq_server_relations.py'
55--- hooks/rabbitmq_server_relations.py 2015-09-10 16:16:02 +0000
56+++ hooks/rabbitmq_server_relations.py 2015-09-23 19:38:09 +0000
57@@ -273,11 +273,18 @@
58
59 @hooks.hook('cluster-relation-joined')
60 def cluster_joined(relation_id=None):
61+ relation_settings = {
62+ 'hostname': get_local_nodename(),
63+ }
64+
65 if config('prefer-ipv6'):
66- relation_settings = {'hostname': socket.gethostname(),
67- 'private-address': get_ipv6_addr()[0]}
68- relation_set(relation_id=relation_id,
69- relation_settings=relation_settings)
70+ relation_settings['private-address'] = get_ipv6_addr()[0]
71+ else:
72+ relation_settings['private-address'] = get_host_ip(
73+ unit_get('private-address'))
74+
75+ relation_set(relation_id=relation_id,
76+ relation_settings=relation_settings)
77
78 if is_relation_made('ha') and \
79 config('ha-vip-only') is False:
80@@ -324,10 +331,13 @@
81 log('cluster_joined: cookie not yet set.', level=INFO)
82 return
83
84- if config('prefer-ipv6') and rdata.get('hostname'):
85- private_address = rdata.get('private-address')
86- hostname = rdata.get('hostname')
87- if hostname:
88+ rdata = relation_get()
89+
90+ if rdata:
91+ hostname = rdata.get('hostname', None)
92+ private_address = rdata.get('private-address', None)
93+
94+ if hostname and private_address:
95 rabbit.update_hosts_file({private_address: hostname})
96
97 if not is_sufficient_peers():

Subscribers

People subscribed via source and target branches