From: Zane Bitter Date: Fri, 11 May 2012 16:54:38 +0000 (+0200) Subject: Add uninstall script X-Git-Tag: 2014.1~1844 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=876a450a4e0a4a30f5e5097b837cf88ff61d2aad;p=openstack-build%2Fheat-build.git Add uninstall script Signed-off-by: Zane Bitter --- diff --git a/tools/uninstall-heat b/tools/uninstall-heat new file mode 100755 index 00000000..3527ec85 --- /dev/null +++ b/tools/uninstall-heat @@ -0,0 +1,73 @@ +#!/bin/bash + +TOOLS_DIR=`dirname $0` +if [ "$1" = "-y" ]; then + SKIP_ASK=y +fi + +user_wants() { + if [ "$SKIP_ASK" = "y" ]; then return 0; fi + + read -n 1 -p "$1 " cont + echo 1>&2 + case $cont in + y|Y) + return 0 + ;; + *) + return 1 + ;; + esac +} + +HEAT_PIDS=`pgrep 'heat-.+'` +if [ -n "$HEAT_PIDS" ]; then + echo 'The following Heat processes are running:' 1>&2 + ps $HEAT_PIDS 1>&2 + if user_wants 'Kill them?'; then + sudo kill $HEAT_PIDS + fi + echo 1>&2 +fi + +if user_wants 'Drop Heat database tables?'; then + $TOOLS_DIR/heat-db-drop + echo 1>&2 +fi + +if user_wants 'Erase OpenStack installation?'; then + $TOOLS_DIR/openstack erase + echo 1>&2 +fi + +HEAT_EGGS=`find ${PYTHONHOME:-/usr/lib/python2.7}/site-packages/ -maxdepth 1 -type d -name 'heat-*.egg'` +if [ -n "$HEAT_EGGS" ]; then + echo 'The following Heat installations were found:' 1>&2 + echo "$HEAT_EGGS" 1>&2 + if user_wants 'Delete them?'; then + sudo rm -rf $HEAT_EGGS + fi + echo 1>&2 +fi + +if user_wants 'Delete Heat binaries?'; then + BIN_PATH=/usr/bin + sudo rm -f $BIN_PATH/heat-db-setup + sudo rm -f $BIN_PATH/heat-metadata + sudo rm -f $BIN_PATH/heat-api + sudo rm -f $BIN_PATH/heat-engine + sudo rm -f $BIN_PATH/heat + + echo 1>&2 +fi + +if user_wants 'Delete Heat configuration?'; then + sudo rm -rf /etc/heat + echo 1>&2 +fi + +if user_wants 'Delete Heat logs?'; then + sudo rm -rf /var/log/heat + echo 1>&2 +fi +