distillery icon indicating copy to clipboard operation
distillery copied to clipboard

Appending sname/name with hostname is not in sync with Erlang

Open lukyanov opened this issue 6 years ago • 0 comments

Steps to reproduce

  1. Set -name in vm.args as foo (without @).
  2. Build the release.

Description of issue

The issue is this. Erlang relies on a fully qualified host name when appending the node name. Distillery, however, relies on $HOSTNAME to do the same. This may result to situations when commands like remote_console won't work. The example of such a situation would be a host with no DNS name setup: Erlang translates foo to [email protected], but distillery - to foo@hostname.

The expected result would be to use the same appending mechanism that Erlang does. Erlang seems to rely on what the command hostname -f returns.

Suggested fix:

--- a/priv/libexec/helpers.sh
+++ b/priv/libexec/helpers.sh
@@ -48,7 +48,7 @@ gen_nodename() {
 get_hostname() {
     host="$(echo "${NAME}" | cut -d'@' -f2 -s)"
     if [ -z "$host" ]; then
-        echo "${HOSTNAME}"
+        /bin/hostname -f
     else
         echo "$host"
     fi

lukyanov avatar Oct 14 '19 07:10 lukyanov