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.
This commit is contained in:
Jean-Sébastien Pédron 2015-11-04 11:25:33 +01:00
parent 765218a666
commit fdb1eb485c
1 changed files with 4 additions and 12 deletions

View File

@ -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() {