diff options
author | Devan Goodwin <dgoodwin@redhat.com> | 2016-06-21 15:01:01 -0300 |
---|---|---|
committer | Devan Goodwin <dgoodwin@redhat.com> | 2016-06-23 10:42:47 -0300 |
commit | 82f4e4eaeaaf3059013e9ea23d87dcf89fd8455e (patch) | |
tree | b90f8a8db3b11ea10b317c88e8722569a12112e6 /playbooks/common/openshift-cluster/upgrades/files | |
parent | 5c7e3e9d3a36062a6bf0d79da0c95e1f2e17b9a0 (diff) | |
download | openshift-82f4e4eaeaaf3059013e9ea23d87dcf89fd8455e.tar.gz openshift-82f4e4eaeaaf3059013e9ea23d87dcf89fd8455e.tar.bz2 openshift-82f4e4eaeaaf3059013e9ea23d87dcf89fd8455e.tar.xz openshift-82f4e4eaeaaf3059013e9ea23d87dcf89fd8455e.zip |
Refactor 3.2 upgrade to avoid killing nodes without evac.
We now handle the two pieces of upgrade that require a node evac in the
same play. (docker, and node itself)
Diffstat (limited to 'playbooks/common/openshift-cluster/upgrades/files')
-rw-r--r-- | playbooks/common/openshift-cluster/upgrades/files/nuke_images.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/playbooks/common/openshift-cluster/upgrades/files/nuke_images.sh b/playbooks/common/openshift-cluster/upgrades/files/nuke_images.sh new file mode 100644 index 000000000..9a5ee2276 --- /dev/null +++ b/playbooks/common/openshift-cluster/upgrades/files/nuke_images.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# Stop any running containers +running_container_count=`docker ps -q | wc -l` +if test $running_container_count -gt 0 +then + docker stop $(docker ps -q) +fi + +# Delete all containers +container_count=`docker ps -a -q | wc -l` +if test $container_count -gt 0 +then + docker rm -f -v $(docker ps -a -q) +fi + +# Delete all images (forcefully) +image_count=`docker images -q | wc -l` +if test $image_count -gt 0 +then + # Taken from: https://gist.github.com/brianclements/f72b2de8e307c7b56689#gistcomment-1443144 + docker rmi $(docker images | grep "$2/\|/$2 \| $2 \|$2 \|$2-\|$2_" | awk '{print $1 ":" $2}') 2>/dev/null || echo "No images matching \"$2\" left to purge." +fi |