diff options
author | Andrew Thompson <andrew@hijacked.us> | 2014-03-05 15:22:28 -0500 |
---|---|---|
committer | Andrew Thompson <andrew@hijacked.us> | 2014-03-05 15:22:28 -0500 |
commit | 17fe5d6f1c1d7f45141a7f81bdbbb4b7334fe99b (patch) | |
tree | 253a7e01cbc0385deed116214eb20136841b0c87 /priv | |
parent | ab571fd2aa4194353bfe408e04253b2f3dab6c1c (diff) | |
parent | cdfcc27087a8989a562695a5e963bd76bb39ca8f (diff) |
Merge pull request #115 from mdaguete/simplenode.runner-remsh-fixes
Incorrect REMSH args when sname is used.
Diffstat (limited to 'priv')
-rwxr-xr-x | priv/templates/simplenode.runner | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/priv/templates/simplenode.runner b/priv/templates/simplenode.runner index 2786e72..032eb28 100755 --- a/priv/templates/simplenode.runner +++ b/priv/templates/simplenode.runner @@ -86,10 +86,36 @@ fi REMSH_TYPE=`echo $NAME_ARG | awk '{print $1}'` REMSH_NAME=`echo $NAME_ARG | awk '{print $2}'` +# Test if REMSH_NAME contains a @ and set REMSH_HOSTNAME_PART +# and REMSH_NAME_PART according REMSH_TYPE +MAYBE_FQDN_HOSTNAME=`hostname` +HOSTNAME=`echo $MAYBE_FQDN_HOSTNAME | awk -F. '{print $1}'` + +REMSH_HOSTNAME_PART="$MAYBE_FQDN_HOSTNAME" +case "$REMSH_NAME" in + *@*) + REMSH_HOSTNAME_PART=`echo $REMSH_NAME | awk -F@ '{print $2}'` + REMSH_NAME_PART=`echo $REMSH_NAME | awk -F@ '{print $1}'` + ;; + *) + REMSH_NAME_PART="$REMSH_NAME" + if [ "$REMSH_TYPE" = "-sname" ]; then + REMSH_HOSTNAME_PART= "$HOSTNAME" + else + # -name type, check if `hostname` is fqdn + if [ "$MAYBE_FQDN_HOSTNAME" = "$HOSTNAME" ]; then + echo "Hostname must be a fqdn domain name when node is configured with long names" + echo "and the full node name isn't configured in vm.args" + exit 1 + fi + fi + ;; +esac + # Note the `date +%s`, used to allow multiple remsh to the same node # transparently -REMSH_NAME_ARG="$REMSH_TYPE remsh`date +%s`@`echo $REMSH_NAME | awk -F@ '{print $2}'`" -REMSH_REMSH_ARG="-remsh $REMSH_NAME" +REMSH_NAME_ARG="$REMSH_TYPE remsh`date +%s`@$REMSH_HOSTNAME_PART" +REMSH_REMSH_ARG="-remsh $REMSH_NAME_PART@$REMSH_HOSTNAME_PART" # Extract the target cookie COOKIE_ARG=`grep '^\-setcookie' $VMARGS_PATH` @@ -111,7 +137,7 @@ ERTS_PATH=$RUNNER_BASE_DIR/erts-$ERTS_VSN/bin NODETOOL="$ERTS_PATH/escript $ERTS_PATH/nodetool $NAME_ARG $COOKIE_ARG" # Setup remote shell command to control node -REMSH="$ERTS_PATH/erl $REMSH_NAME_ARG $REMSH_REMSH_ARG $COOKIE_ARG" +REMSH="$ERTS_PATH/erl -hidden $REMSH_NAME_ARG $REMSH_REMSH_ARG $COOKIE_ARG" # Common functions |