From 5d4272baefbd539e4ba13e6192770933f16d45d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Dura=CC=81n=20Aguete?= Date: Mon, 8 Jul 2013 10:44:42 +0200 Subject: Incorrect REMSH args when sname is used When a node is configured with -sname in app.config or sys.config the REMSH_NAME_ARG and REMSH_REMSH_ARG arguments are incorrect due the assumption that the node name always contains '@'. To fix the bug, the script tries to find '@' and then compose the arguments acording to node name type. If in long name mode the script can't compose a correct node name exits with warning. --- priv/templates/simplenode.runner | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/priv/templates/simplenode.runner b/priv/templates/simplenode.runner index c2ef258..e8abd20 100755 --- a/priv/templates/simplenode.runner +++ b/priv/templates/simplenode.runner @@ -85,10 +85,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` -- cgit v1.1 From cdfcc27087a8989a562695a5e963bd76bb39ca8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Dura=CC=81n=20Aguete?= Date: Thu, 11 Jul 2013 10:24:31 +0200 Subject: Make REMSH node run in hidden mode To avoid problems with REMSH node being visible from another nodes starts it in hidden mode (erl -hidden). --- priv/templates/simplenode.runner | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/priv/templates/simplenode.runner b/priv/templates/simplenode.runner index e8abd20..260d067 100755 --- a/priv/templates/simplenode.runner +++ b/priv/templates/simplenode.runner @@ -136,7 +136,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 -- cgit v1.1