summaryrefslogtreecommitdiffstats
path: root/components/congress/install/bash/clean_congress.sh
diff options
context:
space:
mode:
Diffstat (limited to 'components/congress/install/bash/clean_congress.sh')
-rw-r--r--components/congress/install/bash/clean_congress.sh77
1 files changed, 30 insertions, 47 deletions
diff --git a/components/congress/install/bash/clean_congress.sh b/components/congress/install/bash/clean_congress.sh
index b00a050..9180f38 100644
--- a/components/congress/install/bash/clean_congress.sh
+++ b/components/congress/install/bash/clean_congress.sh
@@ -17,59 +17,42 @@
# node as installed via JOID or Apex (Fuel and Compass not yet verified).
# Presumably something has failed, and any record of the Congress feature
# in OpenStack needs to be removed, so you can try the install again.
+# This is script 2 of 2 for installation of OpenStack Congress.
# Prerequisites:
-# - OPFNV installed via JOID or Apex
-# - For Apex installs, on the jumphost, ssh to the undercloud VM and
-# $ su stack
-# - For JOID installs, admin-openrc.sh saved from Horizon to ~/admin-openrc.sh
-# - Retrieve the copper removal script as below
-# $ cd ~
-# $ wget https://git.opnfv.org/cgit/copper/plain/components/congress/install/bash/clean_congress.sh
-# $ bash clean_congress.sh
-
-sudo -i
-
-echo "OS-specific prerequisite steps"
-dist=`grep DISTRIB_ID /etc/*-release | awk -F '=' '{print $2}'`
-
-source ~/congress/env.sh
-
-if [ "$dist" == "Ubuntu" ]; then
- # Ubuntu
- echo "Ubuntu-based install"
- export CTLUSER="ubuntu"
- echo "Stop the Congress service"
- # Have to use "python" here as congress-server does not show up in the process list (?)
- ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $CTLUSER@$CONGRESS_HOST "pkill python; exit"
-else
- export CTLUSER="heat-admin"
- echo "Stop the Congress service"
- ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $CTLUSER@$CONGRESS_HOST "pkill congress-server; exit"
+# - OpenStack base deployment.
+# Usage:
+# $ bash clean_congress.sh <target> <user>
+# <target>: IP/hostname where Congress is being installed
+# localhost: install in a docker container on the current host
+# IP address: install in a virtualenv
+# <user>: IP/hostname where Congress is being installed
+#
+target=$1
+user=$2
+
+source /opt/congress/admin-openrc.sh
+source /opt/congress/venv/bin/activate
+
+if [[ "$target" == "localhost" ]]; then
+ sudo docker stop congress
+ sudo docker rm -v congress
+else
+ echo "Remove systemd integration"
+ ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $user@$target "sudo rm -f /usr/lib/systemd/system/openstack-congress.service; sudo rm -f /etc/init.d/congress-server; exit"
+
+ echo "Remove the Congress virtualenv and code"
+ ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $user@$target "rm -rf /opt/congress; exit"
+
+ echo "Delete Congress database"
+ ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $user@$target "sudo mysql -e \"DROP DATABASE congress\"; exit"
fi
-source ~/admin-openrc.sh
-
-echo "Remove systemd integration"
-ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $CTLUSER@$CONGRESS_HOST "sudo rm -f /usr/lib/systemd/system/openstack-congress.service; sudo rm -f /etc/init.d/congress-server; exit"
-
-echo "Remove the Congress virtualenv and code"
-ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $CTLUSER@$CONGRESS_HOST "rm -rf ~/congress; exit"
-
echo "Delete Congress user"
-export CONGRESS_USER=$(openstack user list | awk "/ congress / { print \$2 }")
-if [ "$CONGRESS_USER" != "" ]; then
- openstack user delete $CONGRESS_USER
-fi
+openstack user delete congress
echo "Delete Congress service"
-export CONGRESS_SERVICE=$(openstack service list | awk "/ congress / { print \$2 }")
-if [ "$CONGRESS_SERVICE" != "" ]; then
- openstack service delete $CONGRESS_SERVICE
-fi
-
-echo "Delete Congress database"
-ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $CTLUSER@$CONGRESS_HOST "sudo mysql -e \"DROP DATABASE congress\"; exit"
+openstack service delete congress
echo "Delete Congress and other installed code in virtualenv"
-rm -rf ~/congress
+sudo rm -rf /opt/congress