From 8a2489fa9014decefb4ef44b196c62cb92695300 Mon Sep 17 00:00:00 2001 From: seokho-son Date: Wed, 25 Aug 2021 05:16:19 +0900 Subject: [PATCH] Apply init.sh into gen-sshKey.sh --- src/testclient/scripts/init.sh | 2 ++ ...command-mcis-custom.sh => command-mcis.sh} | 0 .../scripts/sequentialFullTest/gen-sshKey.sh | 24 ++----------------- 3 files changed, 4 insertions(+), 22 deletions(-) rename src/testclient/scripts/sequentialFullTest/{command-mcis-custom.sh => command-mcis.sh} (100%) diff --git a/src/testclient/scripts/init.sh b/src/testclient/scripts/init.sh index c1c88c77f..ed1b068ae 100755 --- a/src/testclient/scripts/init.sh +++ b/src/testclient/scripts/init.sh @@ -21,5 +21,7 @@ source ../credentials.conf getCloudIndex $CSP MCISID=${MCISPREFIX}-${POSTFIX} +#install jq and puttygen echo "[Check jq package (if not, install)]" if ! dpkg-query -W -f='${Status}' jq | grep "ok installed"; then sudo apt install -y jq; fi +if ! dpkg-query -W -f='${Status}' putty-tools | grep "ok installed"; then sudo apt install -y putty-tools; fi diff --git a/src/testclient/scripts/sequentialFullTest/command-mcis-custom.sh b/src/testclient/scripts/sequentialFullTest/command-mcis.sh similarity index 100% rename from src/testclient/scripts/sequentialFullTest/command-mcis-custom.sh rename to src/testclient/scripts/sequentialFullTest/command-mcis.sh diff --git a/src/testclient/scripts/sequentialFullTest/gen-sshKey.sh b/src/testclient/scripts/sequentialFullTest/gen-sshKey.sh index 91e9a785e..03cd64716 100755 --- a/src/testclient/scripts/sequentialFullTest/gen-sshKey.sh +++ b/src/testclient/scripts/sequentialFullTest/gen-sshKey.sh @@ -1,36 +1,16 @@ #!/bin/bash -TestSetFile=${4:-../testSet.env} -if [ ! -f "$TestSetFile" ]; then - echo "$TestSetFile does not exist." - exit -fi -source $TestSetFile -source ../conf.env - echo "####################################################################" echo "## Generate SSH KEY (PEM, PPK)" echo "####################################################################" -CSP=${1} -REGION=${2:-1} -POSTFIX=${3:-developer} - -source ../common-functions.sh -getCloudIndex $CSP - -MCISID=${CONN_CONFIG[$INDEX,$REGION]}-${POSTFIX} +source ../init.sh if [ "${INDEX}" == "0" ]; then # MCISPREFIX=avengers MCISID=${MCISPREFIX}-${POSTFIX} fi -#install jq and puttygen -echo "[Check jq and putty-tools package (if not, install)]" -if ! dpkg-query -W -f='${Status}' jq | grep "ok installed"; then sudo apt install -y jq; fi -if ! dpkg-query -W -f='${Status}' putty-tools | grep "ok installed"; then sudo apt install -y putty-tools; fi - # curl -H "${AUTH}" -sX GET http://$TumblebugServer/tumblebug/ns/$NSID/resources/sshKey/$MCIRID -H 'Content-Type: application/json' | jq '.privateKey' | sed -e 's/\\n/\n/g' -e 's/\"//g' > ./sshkey-tmp/$MCISID.pem # chmod 600 ./sshkey-tmp/$MCISID.pem # puttygen ./sshkey-tmp/$MCISID.pem -o ./sshkey-tmp/$MCISID.ppk -O private @@ -39,7 +19,7 @@ echo "" echo "[CHECK REMOTE COMMAND BY CB-TB API]" echo " This will retrieve verified SSH username" -./command-mcis.sh $CSP $REGION $POSTFIX $TestSetFile +./command-mcis.sh -n $POSTFIX -f $TestSetFile MCISINFO=$(curl -H "${AUTH}" -sX GET http://$TumblebugServer/tumblebug/ns/$NSID/mcis/${MCISID}?action=status) VMARRAY=$(jq '.status.vm' <<<"$MCISINFO")