Improvements to uninstall script

- Kill only the specific heat processes we want (heat-api and heat-engine).
- Remove installations wherever they may be located.
- More robust handling of input.

Signed-off-by: Zane Bitter <zbitter@redhat.com>
This commit is contained in:
Zane Bitter 2012-05-21 14:53:03 +02:00
parent 80302ceffd
commit 45702a0d26

View File

@ -9,19 +9,23 @@ fi
user_wants() { user_wants() {
if [ "$SKIP_ASK" = "y" ]; then return 0; fi if [ "$SKIP_ASK" = "y" ]; then return 0; fi
read -n 1 -p "$1 " cont while true; do
echo 1>&2 read -n 1 -p "$1 " cont
case $cont in echo 1>&2
y|Y) case $cont in
return 0 y|Y)
;; return 0
*) ;;
return 1 n|N)
;; return 1
esac ;;
*)
;;
esac
done
} }
HEAT_PIDS=`pgrep 'heat-.+'` HEAT_PIDS=`pgrep '^heat-(api|engine)$'`
if [ -n "$HEAT_PIDS" ]; then if [ -n "$HEAT_PIDS" ]; then
echo 'The following Heat processes are running:' 1>&2 echo 'The following Heat processes are running:' 1>&2
ps $HEAT_PIDS 1>&2 ps $HEAT_PIDS 1>&2
@ -41,7 +45,7 @@ if user_wants 'Erase OpenStack installation?'; then
echo 1>&2 echo 1>&2
fi fi
HEAT_EGGS=`find ${PYTHONHOME:-/usr/lib/python2.7}/site-packages/ -maxdepth 1 -type d -name 'heat-*.egg'` HEAT_EGGS=`python -c 'import sys; print "\n".join(sys.path)' | grep '/heat-[^/]*\.egg$'`
if [ -n "$HEAT_EGGS" ]; then if [ -n "$HEAT_EGGS" ]; then
echo 'The following Heat installations were found:' 1>&2 echo 'The following Heat installations were found:' 1>&2
echo "$HEAT_EGGS" 1>&2 echo "$HEAT_EGGS" 1>&2