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
1=== modified file 'hooks/rabbitmq_server_relations.py'
2--- hooks/rabbitmq_server_relations.py 2014-10-29 14:12:26 +0000
3+++ hooks/rabbitmq_server_relations.py 2014-11-03 17:29:52 +0000
4@@ -5,6 +5,7 @@
5 import sys
6 import subprocess
7 import glob
8+import socket
9
10 import rabbit_utils as rabbit
11 from lib.utils import (
12@@ -163,8 +164,16 @@
13 # Set RABBITMQ_NODENAME to something that's resolvable by my peers
14 # get_host_ip() is called to sanitize private-address in case it
15 # doesn't return an IP address
16- nodename = get_hostname(get_host_ip(unit_get('private-address')),
17- fqdn=False)
18+ ip_addr = get_host_ip(unit_get('private-address'))
19+ try:
20+ nodename = get_hostname(ip_addr, fqdn=False)
21+ except:
22+ log('Cannot resolve hostname for %s using DNS servers' % ip_addr)
23+ log('Falling back to use socket.gethostname()')
24+ #If the private-address is not resolvable using DNS
25+ # then use the current hostname
26+ nodename = socket.gethostname()
27+
28 if nodename:
29 log('forcing nodename=%s' % nodename)
30 # need to stop it under current nodename

Subscribers

People subscribed via source and target branches