Merge lp:~gz/juju-ci-tools/remove_manual_juju_fix_2 into lp:juju-ci-tools

Proposed by Martin Packman
Status: Merged
Approved by: Martin Packman
Approved revision: 1150
Merged at revision: 1149
Proposed branch: lp:~gz/juju-ci-tools/remove_manual_juju_fix_2
Merge into: lp:juju-ci-tools
Diff against target: 26 lines (+5/-5)
1 file modified
remove-manual-juju.bash (+5/-5)
To merge this branch: bzr merge lp:~gz/juju-ci-tools/remove_manual_juju_fix_2
Reviewer Review Type Date Requested Status
Aaron Bentley (community) Approve
Review via email: mp+277376@code.launchpad.net

Description of the change

Really fix manual provisioning cleanup script

First shot didn't do the right thing. This one sorts out the env vars, and makes the jujud conditional simpler and removes that as a prerequisite for killing mongod processes.

To post a comment you must log in.
Revision history for this message
Aaron Bentley (abentley) wrote :

This is fine. ps -C will exit with a nonzero status if the argument doesn't match any processes, so you could also do:

"if ps -C jujud; then"

review: Approve
1150. By Martin Packman

Tweak to ps command suggested by abentley in review

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'remove-manual-juju.bash'
2--- remove-manual-juju.bash 2015-11-12 15:39:16 +0000
3+++ remove-manual-juju.bash 2015-11-12 18:45:35 +0000
4@@ -1,17 +1,17 @@
5 #!/bin/bash
6
7-JUJU_DIR="/var/lib/juju"
8-DUMMY_DIR="/var/run/dummy-sink"
9 ips="$@"
10 for ip in $ips; do
11 ssh -i $JUJU_HOME/staging-juju-rsa ubuntu@$ip <<"EOT"
12 #!/bin/bash
13 set -ux
14-if [[ -n "$(ps ax | grep jujud | grep -v grep)" ]]; then
15- sudo touch /var/lib/juju/uninstall-agent
16+JUJU_DIR="/var/lib/juju"
17+DUMMY_DIR="/var/run/dummy-sink"
18+if ps -f -C jujud; then
19+ sudo touch $JUJU_DIR/uninstall-agent
20 sudo killall -SIGABRT jujud
21- sudo killall -9 mongod
22 fi
23+sudo killall -9 mongod || true
24 if [[ -d $JUJU_DIR ]]; then
25 sudo rm -r $JUJU_DIR
26 fi

Subscribers

People subscribed via source and target branches