Merge lp:~jjo/charms/trusty/rabbitmq-server/fix-nodename-to-host-dns-PTR into lp:charms/trusty/rabbitmq-server

Proposed by JuanJo Ciarlante
Status: Merged
Merged at revision: 62
Proposed branch: lp:~jjo/charms/trusty/rabbitmq-server/fix-nodename-to-host-dns-PTR
Merge into: lp:charms/trusty/rabbitmq-server
Diff against target: 33 lines (+16/-0)
1 file modified
hooks/rabbitmq_server_relations.py (+16/-0)
To merge this branch: bzr merge lp:~jjo/charms/trusty/rabbitmq-server/fix-nodename-to-host-dns-PTR
Reviewer Review Type Date Requested Status
Liam Young (community) Approve
Review Queue (community) automated testing Needs Fixing
Review via email: mp+236041@code.launchpad.net

Commit message

[jjo] fixup rabbitmq nodename to DNS's PTR for node ip, to make it match peer's join_cluster.
Seems to fix lp#1342539.

To post a comment you must log in.
60. By David Britton

resync charmhelpers, make use of version compare from charmhelpers. [r=dpb] [a=tribaal]

Revision history for this message
Review Queue (review-queue) wrote :

This items has failed automated testing! Results available here http://reports.vapour.ws/charm-tests/charm-bundle-test-1114-results

review: Needs Fixing (automated testing)
61. By Liam Young

[davidpbritton, r=hopem, r=gnuoy]
- make use of new compare_versions logic in charm helpers (fixing lp:1375084)
- add unit test for the same

62. By JuanJo Ciarlante

[jjo] fixup rabbitmq nodename to DNS's PTR for node ip, to make it match peer's join_cluster

Revision history for this message
JuanJo Ciarlante (jjo) wrote :

Fixed text conflicts by resyncing over r61, PTAL.

Revision history for this message
Liam Young (gnuoy) wrote :

Approved

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/rabbitmq_server_relations.py'
2--- hooks/rabbitmq_server_relations.py 2014-09-29 03:59:17 +0000
3+++ hooks/rabbitmq_server_relations.py 2014-10-01 11:55:45 +0000
4@@ -15,6 +15,10 @@
5 is_clustered,
6 eligible_leader
7 )
8+from charmhelpers.contrib.openstack.utils import (
9+ get_hostname,
10+ get_host_ip
11+)
12
13 import charmhelpers.contrib.storage.linux.ceph as ceph
14 from charmhelpers.contrib.openstack.utils import save_script_rc
15@@ -146,6 +150,18 @@
16 'rabbitmq cluster config.')
17 return
18
19+ # Set RABBITMQ_NODENAME to something that's resolvable by my peers
20+ # get_host_ip() is called to sanitize private-address in case it
21+ # doesn't return an IP address
22+ nodename = get_hostname(get_host_ip(unit_get('private-address')),
23+ fqdn=False)
24+ if nodename:
25+ log('forcing nodename=%s' % nodename)
26+ # need to stop it under current nodename
27+ service_stop('rabbitmq-server')
28+ rabbit.set_node_name('rabbit@%s' % nodename)
29+ service_restart('rabbitmq-server')
30+
31 if is_newer():
32 log('cluster_joined: Relation greater.')
33 return

Subscribers

People subscribed via source and target branches