summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJustin Ross <jross@apache.org>2014-09-09 19:28:29 +0000
committerJustin Ross <jross@apache.org>2014-09-09 19:28:29 +0000
commit45e29ddd6feb74189d67b87683332ec5be00e6ee (patch)
tree0fef374bb229c98d0dcfcafba012478b955be3d8 /tools
parent57114154a67b7b85ec061366ea8b3ea024ccba8d (diff)
downloadqpid-python-45e29ddd6feb74189d67b87683332ec5be00e6ee.tar.gz
QPID-6007: Test if hostname is valid; if not, default to trying localhost; this is a patch from Ernie Allen
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1623871 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'tools')
-rwxr-xr-xtools/src/py/qpid-route6
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/src/py/qpid-route b/tools/src/py/qpid-route
index 185a6ce798..6890f2a819 100755
--- a/tools/src/py/qpid-route
+++ b/tools/src/py/qpid-route
@@ -509,7 +509,11 @@ def main(argv=None):
return(-1)
if nargs == 2:
- localBroker = socket.gethostname()
+ try:
+ socket.gethostbyname(socket.gethostname())
+ localBroker = socket.gethostname()
+ except socket.gaierror:
+ localBroker = "localhost"
else:
if config._srclocal:
localBroker = args[3]