forked from cloud-barista/cloud-barista
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommand-mcis.sh
executable file
·34 lines (30 loc) · 987 Bytes
/
command-mcis.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
source ../conf.env
echo "####################################################################"
echo "## Command (SSH) to MCIS "
echo "####################################################################"
CSP=${1}
REGION=${2:-1}
POSTFIX=${3:-developer}
if [ "${CSP}" == "aws" ]; then
echo "[Test for AWS]"
INDEX=1
elif [ "${CSP}" == "azure" ]; then
echo "[Test for Azure]"
INDEX=2
elif [ "${CSP}" == "gcp" ]; then
echo "[Test for GCP]"
INDEX=3
elif [ "${CSP}" == "alibaba" ]; then
echo "[Test for Alibaba]"
INDEX=4
else
echo "[No acceptable argument was provided (aws, azure, gcp, alibaba, ...). Default: Test for AWS]"
CSP="aws"
INDEX=1
fi
MCISID=${CONN_CONFIG[$INDEX,$REGION]}-${POSTFIX}
curl -sX POST http://$TumblebugServer/tumblebug/ns/$NS_ID/cmd/mcis/$MCISID -H 'Content-Type: application/json' -d \
'{
"command": "echo -n [CMD] Works! [Public IP: ; curl https://api.ipify.org ; echo -n ], [Hostname: ; hostname ; echo -n ]"
}' | json_pp #|| return 1