Skip to content

Instantly share code, notes, and snippets.

@freyes
Created April 12, 2021 21:52
Show Gist options
  • Save freyes/8ffc2b614cb8e9c89c63502c0be2de1c to your computer and use it in GitHub Desktop.
Save freyes/8ffc2b614cb8e9c89c63502c0be2de1c to your computer and use it in GitHub Desktop.
#!/bin/bash -u
MODEL=
TIMEOUT=10s
DESTROY_MODEL_OPTS=( )
while true; do
case "$1" in
-t)
shift
COLOR=$1
;;
-y)
DESTROY_MODEL_OPTS+=( -y )
;;
--destroy-storage)
DESTROY_MODEL_OPTS+=( --destroy-storage )
;;
*)
MODEL=$1
shift
break
;;
esac
shift
done
juju destroy-model -t $TIMEOUT ${DESTROY_MODEL_OPTS[@]} $MODEL
juju remove-machine --force -m $MODEL $(juju status --format json -m $MODEL | jq -r '.machines|keys[]')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment