Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove juju-mongo in manual clean-up #6675

Merged
merged 1 commit into from Dec 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion provider/manual/environ.go
Expand Up @@ -242,12 +242,13 @@ touch %s
# If jujud is running, we then wait for a while for it to stop.
stopped=0
if pkill -%d jujud; then
for i in ` + "`seq 1 30`" + `; do
for i in {1..30}; do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we confident this is always bash?

:~$ dash
$ for i in {0..10}; do                          
> 	echo $i
> done
{0..10}
$ for i in `seq 1 10`; do
> 	echo $i
> done
1
2
...
`

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are; /bin/bash is passed in to the ssh command to run this script.

if pgrep jujud > /dev/null ; then
sleep 1
else
echo "jujud stopped"
stopped=1
logger --id jujud stopped on attempt $i
break
fi
done
Expand All @@ -256,7 +257,10 @@ if [ $stopped -ne 1 ]; then
# If jujud didn't stop nicely, we kill it hard here.
%spkill -9 jujud
service %s stop
logger --id killed jujud and stopped %s
fi
apt-get -y purge juju-mongo*
apt-get -y autoremove
rm -f /etc/init/juju*
rm -f /etc/systemd/system{,/multi-user.target.wants}/juju*
rm -fr %s %s
Expand All @@ -283,6 +287,7 @@ exit 0
terminationworker.TerminationSignal,
diagnostics,
mongo.ServiceName,
mongo.ServiceName,
utils.ShQuote(agent.DefaultPaths.DataDir),
utils.ShQuote(agent.DefaultPaths.LogDir),
)
Expand Down
6 changes: 5 additions & 1 deletion provider/manual/environ_test.go
Expand Up @@ -87,12 +87,13 @@ touch '/var/lib/juju/uninstall-agent'
# If jujud is running, we then wait for a while for it to stop.
stopped=0
if pkill -6 jujud; then
for i in `+"`seq 1 30`"+`; do
for i in {1..30}; do
if pgrep jujud > /dev/null ; then
sleep 1
else
echo "jujud stopped"
stopped=1
logger --id jujud stopped on attempt $i
break
fi
done
Expand All @@ -101,7 +102,10 @@ if [ $stopped -ne 1 ]; then
# If jujud didn't stop nicely, we kill it hard here.
pkill -9 jujud
service juju-db stop
logger --id killed jujud and stopped juju-db
fi
apt-get -y purge juju-mongo*
apt-get -y autoremove
rm -f /etc/init/juju*
rm -f /etc/systemd/system{,/multi-user.target.wants}/juju*
rm -fr '/var/lib/juju' '/var/log/juju'
Expand Down