Merge lp:~niedbalski/charms/trusty/rabbitmq-server/fix-1378263 into lp:charms/trusty/rabbitmq-server

Proposed by Jorge Niedbalski
Status: Merged
Merged at revision: 68
Proposed branch: lp:~niedbalski/charms/trusty/rabbitmq-server/fix-1378263
Merge into: lp:charms/trusty/rabbitmq-server
Diff against target: 30 lines (+11/-2)
1 file modified
hooks/rabbitmq_server_relations.py (+11/-2)
To merge this branch: bzr merge lp:~niedbalski/charms/trusty/rabbitmq-server/fix-1378263
Reviewer Review Type Date Requested Status
Jorge Niedbalski (community) Approve
Felipe Reyes (community) Approve
Review via email: mp+240478@code.launchpad.net

Description of the change

- If there is no a valid DNS response ( A or PTR ) for the current hostname, use the current socket.gethostname() returned address.

Fixes LP: #1378263

To post a comment you must log in.
Revision history for this message
Ryan Beisner (1chb1n) wrote :

UOSCI bot says:
charm_lint_check #917 trusty-rabbitmq-server for niedbalski mp240478
    LINT OK: passed

LINT Results (max last 5 lines):
  I: config.yaml: option vip has no default value
  I: config.yaml: option key has no default value
  I: config.yaml: option ssl_cert has no default value
  I: config.yaml: option ssl_ca has no default value
  I: config.yaml: option source has no default value

Full lint test output: http://paste.ubuntu.com/8805428/
Build: http://10.98.191.181:8080/job/charm_lint_check/917/

Revision history for this message
Ryan Beisner (1chb1n) wrote :

UOSCI bot says:
charm_amulet_test #335 trusty-rabbitmq-server for niedbalski mp240478
    AMULET FAIL: amulet-test missing

AMULET Results (max last 5 lines):
INFO:root:Workspace dir: /var/lib/jenkins/workspace/charm_amulet_test
INFO:root:Reading file: Makefile
INFO:root:Searching for: ['@juju test']
INFO:root:Search string not found in makefile target commands.
ERROR:root:No make target was executed.

Full amulet test output: http://paste.ubuntu.com/8805427/
Build: http://10.98.191.181:8080/job/charm_amulet_test/335/

Revision history for this message
Ryan Beisner (1chb1n) wrote :

UOSCI bot says:
charm_unit_test #752 trusty-rabbitmq-server for niedbalski mp240478
    UNIT OK: passed

UNIT Results (max last 5 lines):
INFO:root:command: make -f Makefile test
  Starting tests...
  CHARM_DIR=/var/lib/jenkins/checkout/trusty-rabbitmq-server PYTHONPATH=/var/lib/jenkins/checkout/trusty-rabbitmq-server/hooks nosetests /var/lib/jenkins/checkout/trusty-rabbitmq-server/hooks
  Ran 1 test in 0.146s
  OK

Full unit test output: http://paste.ubuntu.com/8805429/
Build: http://10.98.191.181:8080/job/charm_unit_test/752/

67. By Jorge Niedbalski

- Improved no hostname found dns message

68. By Jorge Niedbalski

- Refactored according to @freyes comment

Revision history for this message
Felipe Reyes (freyes) wrote :

Looks good to me.

Regarding the use of socket.gethostname() to bypass DNS problems, I patched locally with this same approach and worked for me.

review: Approve
Revision history for this message
Ryan Beisner (1chb1n) wrote :

UOSCI bot says:
charm_amulet_test #336 trusty-rabbitmq-server for niedbalski mp240478
    AMULET FAIL: amulet-test missing

AMULET Results (max last 5 lines):
INFO:root:Workspace dir: /var/lib/jenkins/workspace/charm_amulet_test
INFO:root:Reading file: Makefile
INFO:root:Searching for: ['@juju test']
INFO:root:Search string not found in makefile target commands.
ERROR:root:No make target was executed.

Full amulet test output: http://paste.ubuntu.com/8805665/
Build: http://10.98.191.181:8080/job/charm_amulet_test/336/

Revision history for this message
Ryan Beisner (1chb1n) wrote :

UOSCI bot says:
charm_lint_check #918 trusty-rabbitmq-server for niedbalski mp240478
    LINT OK: passed

LINT Results (max last 5 lines):
  I: config.yaml: option vip has no default value
  I: config.yaml: option key has no default value
  I: config.yaml: option ssl_cert has no default value
  I: config.yaml: option ssl_ca has no default value
  I: config.yaml: option source has no default value

Full lint test output: http://paste.ubuntu.com/8805667/
Build: http://10.98.191.181:8080/job/charm_lint_check/918/

Revision history for this message
Ryan Beisner (1chb1n) wrote :

UOSCI bot says:
charm_unit_test #753 trusty-rabbitmq-server for niedbalski mp240478
    UNIT OK: passed

UNIT Results (max last 5 lines):
INFO:root:command: make -f Makefile test
  Starting tests...
  CHARM_DIR=/var/lib/jenkins/checkout/trusty-rabbitmq-server PYTHONPATH=/var/lib/jenkins/checkout/trusty-rabbitmq-server/hooks nosetests /var/lib/jenkins/checkout/trusty-rabbitmq-server/hooks
  Ran 1 test in 0.134s
  OK

Full unit test output: http://paste.ubuntu.com/8805668/
Build: http://10.98.191.181:8080/job/charm_unit_test/753/

Revision history for this message
Jorge Niedbalski (niedbalski) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'hooks/rabbitmq_server_relations.py'
--- hooks/rabbitmq_server_relations.py 2014-10-29 14:12:26 +0000
+++ hooks/rabbitmq_server_relations.py 2014-11-03 17:29:52 +0000
@@ -5,6 +5,7 @@
5import sys5import sys
6import subprocess6import subprocess
7import glob7import glob
8import socket
89
9import rabbit_utils as rabbit10import rabbit_utils as rabbit
10from lib.utils import (11from lib.utils import (
@@ -163,8 +164,16 @@
163 # Set RABBITMQ_NODENAME to something that's resolvable by my peers164 # Set RABBITMQ_NODENAME to something that's resolvable by my peers
164 # get_host_ip() is called to sanitize private-address in case it165 # get_host_ip() is called to sanitize private-address in case it
165 # doesn't return an IP address166 # doesn't return an IP address
166 nodename = get_hostname(get_host_ip(unit_get('private-address')),167 ip_addr = get_host_ip(unit_get('private-address'))
167 fqdn=False)168 try:
169 nodename = get_hostname(ip_addr, fqdn=False)
170 except:
171 log('Cannot resolve hostname for %s using DNS servers' % ip_addr)
172 log('Falling back to use socket.gethostname()')
173 #If the private-address is not resolvable using DNS
174 # then use the current hostname
175 nodename = socket.gethostname()
176
168 if nodename:177 if nodename:
169 log('forcing nodename=%s' % nodename)178 log('forcing nodename=%s' % nodename)
170 # need to stop it under current nodename179 # need to stop it under current nodename

Subscribers

People subscribed via source and target branches