Skip to content

Commit

Permalink
Apply init.sh into gen-sshKey.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
seokho-son committed Aug 24, 2021
1 parent bcde86e commit 8a2489f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 22 deletions.
2 changes: 2 additions & 0 deletions src/testclient/scripts/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
24 changes: 2 additions & 22 deletions src/testclient/scripts/sequentialFullTest/gen-sshKey.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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")
Expand Down

0 comments on commit 8a2489f

Please sign in to comment.