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 "$@"