erlware / relx

Sane, simple release creation for Erlang
http://erlware.github.io/relx
Apache License 2.0
697 stars 232 forks source link

Grabbing hostname by running a node may not be needed anymore #811

Open tsloughter opened 4 years ago

tsloughter commented 4 years ago

To work around an issue with resolving the hostname being different depending on if you were running a new node or a remote shell we have this code https://github.com/erlware/relx/blob/ad37eef266104872da726db27b4c729f68ffa4b1/priv/templates/extended_bin#L666

# User can specify an sname without @hostname
# This will fail when creating remote shell
# So here we check for @ and add @hostname if missing
case "${NAME}" in
    *@*) ;;                             # Nothing to do
    *)   NAME=${NAME}@$(relx_get_nodename);;  # Add @hostname
esac

The issue may have been fixed in Erlang as now this works:

$ erl -sname a -setcookie a

(a@rosa) 1>
$ erl -remsh a -sname b -setcookie a

(a@rosa)1>

I think it used to not work but would want to confirm and find the patch to OTP that fixed it before starting down the path of removing it (once the oldest supported version works).

Seems it also works for longnames now:

$ erl -name a -setcookie a                                                           ─╯

(a@rosa.lan)1>
$ erl -remsh a -name b -setcookie a                                                  ─╯

(a@rosa.lan)1>