7
5
ssh -i $JUJU_HOME/staging-juju-rsa ubuntu@$ip <<"EOT"
12
8
JUJU_DIR="/var/lib/juju"
13
9
DUMMY_DIR="/var/run/dummy-sink"
15
echo "Cleaning manual machine"
17
# This is left by the test.
18
if [[ -d $DUMMY_DIR ]]; then
22
# Juju always leaves logs behind for debuging, and they are already collected.
23
sudo rm /var/log/juju/*.log || true
25
# Juju must cleanup these procs.
26
10
if ps -f -C jujud; then
28
echo "ERROR manual-provider: jujud left running."
29
11
sudo touch $JUJU_DIR/uninstall-agent
30
12
sudo killall -SIGABRT jujud
32
if ps -f -C mongod; then
34
echo "ERROR manual-provider: mongod left running."
35
sudo killall -9 mongod || true
37
if [[ -d /etc/systemd/system ]]; then
38
found=$(ls /etc/systemd/system/juju*)
39
if [[ -n $found ]]; then
41
echo "ERROR manual-provider: systemd services left behind."
42
for service_path in $found; do
43
service=$(basename $service_path)
44
sudo systemctl stop --force $service || true
45
sudo systemctl disable $service || true
46
sudo rm $service_path || true
50
if [[ -d /etc/init ]]; then
51
found=$(find /etc/init -name 'juju*' -print)
52
if [[ -n $found ]]; then
54
echo "ERROR manual-provider: upstart services left behind."
55
sudo find /etc/init -name 'juju*' -delete || true
14
sudo killall -9 mongod || true
58
15
if [[ -d $JUJU_DIR ]]; then
60
echo "ERROR manual-provider: $JUJU_DIR left behind."
61
16
sudo rm -r $JUJU_DIR
63
echo "Cleaning completed"
18
if [[ -d $DUMMY_DIR ]]; then
21
sudo find /etc/init -name 'juju*' -delete