blob: 2f2cf07cbcafc08ab8200d99c769c5e2f9f422f8 [file] [log] [blame]
David K. Bainbridgef3071012016-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
David K. Bainbridge8b179042016-11-30 15:38:42 -080022LXC=$(which lxc)
23test -z $LXC || lxc delete --force $(lxc list | grep "^| [^ ]" | awk '{print $2}')
24
David K. Bainbridge7ae4f192016-09-29 09:01:38 -070025sudo 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 \{\} \; && sudo rm -f /var/lib/uvtool/libvirt/images/*
David K. Bainbridgef3071012016-08-04 09:29:55 -070026
27OVS=$(which ovs-vsctl)
28
29if [ ! -z $OVS ]; then
30 sudo ovs-vsctl del-br br-int
31fi
32
33sudo ifdown fabric
34sleep 3
35sudo ifup eth0
36sleep 3
37
38IP=$(ifconfig fabric | grep "inet addr" | awk '{print $2}' | cut -d: -f2)
39
40case $(echo "$IP" | cut -d. -f3) in
41 1)
42 TO=$(echo "$IP" | awk -F. '{printf("%s.%s.2.0/24", $1, $2)}')
43 GW=$(echo "$IP" | awk -F. '{printf("%s.%s.%s.254", $1, $2, $3)}')
44 ;;
45 2)
46 TO=$(echo "$IP" | awk -F. '{printf("%s.%s.1.0/24", $1, $2)}')
47 GW=$(echo "$IP" | awk -F. '{printf("%s.%s.%s.254", $1, $2, $3)}')
48 ;;
49esac
50
51sudo route add -net $TO gw $GW