Commit 1e1cb983 authored by Arie Peterson's avatar Arie Peterson 🐚
Browse files

Pass detach_on_shutdown to cosmos on attach

parent 24135df7
......@@ -80,25 +80,23 @@ ghostAction() {
local apiToken=$2
# Numerical ID of disk image.
local diskImage=$3
# Numerical ID of VPS.
# Numerical ID of VPS. Only used for "attach".
local vps=$4
# URL to the Cosmos2 instance to talk to.
local server="$cosmosUrl"
local url="${server}/api/v2/disks/$diskImage/actions"
debug "curling cosmos: $url"
case $action in
attach) ;&
detach) ;;
attach)
local data="{\"type\": \"attach\", \"droplet\": $vps, \"detach_on_shutdown\": true}"
;;
detach)
local data="{\"type\": \"detach\"}"
;;
*)
output "Unsupported action"
exit 0
esac
local url="${server}/api/v2/disks/$diskImage/actions"
debug "curling cosmos: $url"
if [[ -z "$vps" ]]
then
local data="{\"type\": \"$action\"}"
else
local data="{\"type\": \"$action\", \"droplet\": $vps}"
fi
if ! response=$(curl -sS -X POST -H "Authorization: Bearer $apiToken" "$url" -d "$data")
then
exitWithFailure "$response"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment