From c126ffcf79497f77db5d9c4d841f61d8ab70bc08 Mon Sep 17 00:00:00 2001 From: 3wc <3wc@doesthisthing.work> Date: Sun, 11 Jul 2021 12:43:10 +0200 Subject: [PATCH] Don't send ssh_authorized_key_count, improve output --- abra-capsul | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/abra-capsul b/abra-capsul index 1b6a9f3..cd83fca 100755 --- a/abra-capsul +++ b/abra-capsul @@ -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 "$@"