Don't send ssh_authorized_key_count, improve output

This commit is contained in:
3wc 2021-07-11 12:43:10 +02:00
parent 04644cb61f
commit c126ffcf79
1 changed files with 3 additions and 4 deletions

View File

@ -141,20 +141,19 @@ abra_capsul() {
-d "{\"name\":\"$NAME\", \
\"size\": \"$SIZE\", \
\"os\": \"$OS\", \
\"ssh_authorized_key_count\": \"1\", \
\"ssh_key_0\": \"$SSH_KEY\" \
}" \
"$CAPSUL_SERVER/api/capsul/create")
id=$(echo "$response" | $JQ -r ".id")
vm_id=$(echo "$response" | $JQ -r ".id")
if [[ "$id" == "null" ]]; then
if [ "$vm_id" == "null" ] || [ -z "$vm_id" ]; then
error_msg=$(echo "$response" | jq -r ".errors")
echo "Oops, something went wrong. Capsul API responded with: $error_msg"
exit 1
fi
echo "You new Capsul VPS is up, with ID $id. Enjoy!"
echo "You new Capsul VPS is up, with ID $vm_id. Enjoy!"
}
abra_capsul "$@"