List volumes/secrets when removing

This commit is contained in:
Luke Murphy 2021-03-05 12:53:21 +01:00
parent 621c8cd5c4
commit 040374e781
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC

29
abra
View File

@ -1130,24 +1130,31 @@ sub_app_delete (){
rm "$ENV_FILE" rm "$ENV_FILE"
if [ "$abra___force" != "true" ] && [ "$abra___volumes" = "true" ]; then
warning "SCARY: About to remove all volumes associated with ${STACK_NAME}"
prompt_confirm
fi
if [ "$abra___volumes" = "true" ]; then if [ "$abra___volumes" = "true" ]; then
# shellcheck disable=SC2086 volumes="$(docker volume ls --filter "name=${STACK_NAME}" --quiet)"
docker volume rm --force "$(docker volume ls --filter "name=${STACK_NAME}" --quiet)"
fi if [ "$abra___force" != "true" ] && [ "$abra___volumes" = "true" ]; then
# shellcheck disable=SC2086
warning "SCARY: About to remove all volumes associated with ${STACK_NAME}: $(echo $volumes | tr -d '\n')"
if [ "$abra___force" != "true" ] && [ "$abra___secrets" = "true" ]; then
warning "SCARY: About to remove all secrets associated with ${STACK_NAME}"
prompt_confirm prompt_confirm
fi fi
docker volume rm --force "$volumes"
fi
if [ "$abra___secrets" = "true" ]; then if [ "$abra___secrets" = "true" ]; then
secrets="$(docker secret ls --filter "name=${STACK_NAME}" --quiet)"
if [ "$abra___force" != "true" ] && [ "$abra___secrets" = "true" ]; then
# shellcheck disable=SC2086 # shellcheck disable=SC2086
docker secret rm "$(docker secret ls --filter "name=${STACK_NAME}" --quiet)" warning "SCARY: About to remove all secrets associated with ${STACK_NAME}: $(echo $secrets | tr -d '\n')"
prompt_confirm
fi
docker secret rm "$secrets"
fi fi
} }