Skip to content

Instantly share code, notes, and snippets.

@tamirko
Last active May 22, 2017 11:44
Show Gist options
  • Save tamirko/ae6d1bcb99d85c93fc68772b56cd3dbf to your computer and use it in GitHub Desktop.
Save tamirko/ae6d1bcb99d85c93fc68772b56cd3dbf to your computer and use it in GitHub Desktop.
Delete all cfy executions deployments and blueprints
#!/bin/bash
if [ $# -lt 1 ]; then
echo "Error: Missing deployment name/id"
echo " Usage: $0 deployments_id"
exit
fi
deploymentName=$1
clear
echo "Cancelling all executions: *${deploymentName}*..."
cfy deployments list | grep -i "$1" | awk -F\| '{print $2}' | sed 's/ //g' | xargs -I file cfy executions list -d file | grep install | grep -v uninstall | grep started | awk -F\| '{print $2}' | sed 's/ //g' | xargs -I file cfy executions cancel file -f
echo "Uninstalling all deployments: *${deploymentName}*..."
cfy deployments list | grep -i "$1" | awk -F\| '{print $2}' | sed 's/ //g' | xargs -I file cfy executions start -d file -f uninstall -p ignore_failure=true
echo "Deleting all deployments: *${deploymentName}*... "
cfy deployments list | grep -i "$1" | awk -F\| '{print $2}' | sed 's/ //g' | xargs -I file cfy deployments delete -f file
echo "Delete all blueprints: *${deploymentName}*... "
cfy blueprints list | grep -i "$1" | awk -F\| '{print $2}' | sed 's/ //g' | xargs -I file cfy blueprints delete file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment