summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2015-11-04 11:25:33 +0100
committerJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2015-11-04 11:25:33 +0100
commitfdb1eb485c5e7fbeba3c26006ddf1c193367a241 (patch)
treeb4213b133655bcbf13d7b7bfaec849b16d74a60e
parent765218a666681139f3f5f05390c35871090afe49 (diff)
downloadrabbitmq-server-git-fdb1eb485c5e7fbeba3c26006ddf1c193367a241.tar.gz
rabbitmq-env: Revert "Use Erlang to determine local hostname"
After further investigation, the problem was not an inconsistency between hostname(1) and Erlang, but a `/etc/rabbitmq/rabbitmq-env.conf` in Travis CI's host having `NODENAME=rabbit@localhost`. See #402. The real problem is therefore the testsuite which should ignore `/etc/rabbitmq/rabbitmq-env.conf`. The Windows side of the change is kept because it fixes a real issue. References #402.
-rw-r--r--scripts/rabbitmq-env16
1 files changed, 4 insertions, 12 deletions
diff --git a/scripts/rabbitmq-env b/scripts/rabbitmq-env
index c46667097f..0014643260 100644
--- a/scripts/rabbitmq-env
+++ b/scripts/rabbitmq-env
@@ -93,22 +93,14 @@ fi
[ "x" = "x$RABBITMQ_USE_LONGNAME" ] && RABBITMQ_USE_LONGNAME=${USE_LONGNAME}
if [ "xtrue" = "x$RABBITMQ_USE_LONGNAME" ] ; then
RABBITMQ_NAME_TYPE=-name
- NAMETYPE=longnames
+ [ "x" = "x$HOSTNAME" ] && HOSTNAME=`env hostname -f`
+ [ "x" = "x$NODENAME" ] && NODENAME=rabbit@${HOSTNAME}
else
RABBITMQ_NAME_TYPE=-sname
- NAMETYPE=shortnames
+ [ "x" = "x$HOSTNAME" ] && HOSTNAME=`env hostname`
+ [ "x" = "x$NODENAME" ] && NODENAME=rabbit@${HOSTNAME%%.*}
fi
-# We use Erlang to query the local hostname because hostname(1) and
-# Erlang may return different results.
-[ "x" = "x$NODENAME" ] && NODENAME=rabbit@$( \
- erl -A0 -noinput -boot start_clean -eval \
- 'net_kernel:start([list_to_atom("rabbit-gethostname-" ++ os:getpid()), '$NAMETYPE']),
- [_, H] = string:tokens(atom_to_list(node()), "@"),
- io:format("~s~n", [H]),
- halt().')
-unset NAMETYPE
-
##--- Set environment vars RABBITMQ_<var_name> to defaults if not set
rmq_normalize_path() {