blob: d696dda280370197d0518d0d7a6d8ef39954f5dd [file] [log] [blame]
David K. Bainbridge2f3df262016-08-04 09:29:55 -07001#!/bin/bash
2
3J=$(which juju)
4
5if [ ! -z $J ]; then
6 juju remove-machine --force 12
7 juju remove-machine --force 11
8 juju remove-machine --force 10
9
10 RETRY=30
11 while [ $RETRY -gt 0 -a $(juju status --format=tabular | grep "^10\|^11\|^12" | wc -l) -ne 0 ]; do
12 echo -n "."
13 RETRY=$(expr $RETRY - 1)
14 sleep 2
15 done
16 echo
17fi
18
19UVT=$(which uvt-kvm)
20test -z $UVT || uvt-kvm list | xargs uvt-kvm destroy
21
22sudo apt-get remove --purge -y $(dpkg --get-selections | grep "nagioas\|juju\|nova\|neutron" | awk '{print $1}') &&sudo apt-get autoremove -y && sudo rm -rf /etc/juju /etc/neutron /home/ubuntu/.juju && sudo find / -name "*juju*" -exec rm -r \{\} \;
23
24OVS=$(which ovs-vsctl)
25
26if [ ! -z $OVS ]; then
27 sudo ovs-vsctl del-br br-int
28fi
29
30sudo ifdown fabric
31sleep 3
32sudo ifup eth0
33sleep 3
34
35IP=$(ifconfig fabric | grep "inet addr" | awk '{print $2}' | cut -d: -f2)
36
37case $(echo "$IP" | cut -d. -f3) in
38 1)
39 TO=$(echo "$IP" | awk -F. '{printf("%s.%s.2.0/24", $1, $2)}')
40 GW=$(echo "$IP" | awk -F. '{printf("%s.%s.%s.254", $1, $2, $3)}')
41 ;;
42 2)
43 TO=$(echo "$IP" | awk -F. '{printf("%s.%s.1.0/24", $1, $2)}')
44 GW=$(echo "$IP" | awk -F. '{printf("%s.%s.%s.254", $1, $2, $3)}')
45 ;;
46esac
47
48sudo route add -net $TO gw $GW