Merge lp:~axwalk/juju-core/lp1296485-manual-destroy-brokenenv into lp:~go-bot/juju-core/trunk
Proposed by
Andrew Wilkins
Status: | Merged |
---|---|
Approved by: | Andrew Wilkins |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2480 |
Proposed branch: | lp:~axwalk/juju-core/lp1296485-manual-destroy-brokenenv |
Merge into: | lp:~go-bot/juju-core/trunk |
Diff against target: |
73 lines (+30/-4) 2 files modified
provider/manual/environ.go (+19/-2) provider/manual/environ_test.go (+11/-2) |
To merge this branch: | bzr merge lp:~axwalk/juju-core/lp1296485-manual-destroy-brokenenv |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+212610@code.launchpad.net |
Commit message
provider/manual: make Destroy handle broken env
If jujud is running, then killing it with SIGABRT
is the preferred way of cleaning up. Otherwise,
we should fall back to cleaning up manually.
Fixes lp:1296485
Description of the change
provider/manual: make Destroy handle broken env
If jujud is running, then killing it with SIGABRT
is the preferred way of cleaning up. Otherwise,
we should fall back to cleaning up manually.
Fixes lp:1296485
To post a comment you must log in.
Reviewers: mp+212610_ code.launchpad. net,
Message:
Please take a look.
Description:
provider/manual: make Destroy handle broken env
If jujud is running, then killing it with SIGABRT
is the preferred way of cleaning up. Otherwise,
we should fall back to cleaning up manually.
Fixes lp:1296485
https:/ /code.launchpad .net/~axwalk/ juju-core/ lp1296485- manual- destroy- brokenenv/ +merge/ 212610
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/79720045/
Affected files (+32, -4 lines): manual/ environ. go manual/ environ_ test.go
A [revision details]
M provider/
M provider/
Index: [revision details] 20140325120745- 2lmqgyj0xym54h5 1
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-
+New revision: <email address hidden>
Index: provider/ manual/ environ. go manual/ environ. go' manual/ environ. go 2014-03-19 12:16:28 +0000 manual/ environ. go 2014-03-25 13:18:46 +0000 net/juju- core/provider/ common" net/juju- core/state" net/juju- core/state/ api" net/juju- core/utils" net/juju- core/utils/ ssh" net/juju- core/worker/ localstorage" net/juju- core/worker/ terminationwork er"
=== modified file 'provider/
--- provider/
+++ provider/
@@ -28,6 +28,7 @@
"launchpad.
"launchpad.
"launchpad.
+ "launchpad.
"launchpad.
"launchpad.
"launchpad.
@@ -218,18 +219,34 @@
return e.storage
}
-var runSSHCommand = func(host string, command []string) (stderr string, NewReader( stdin)
err error) {
+var runSSHCommand = func(host string, command []string, stdin string)
(stderr string, err error) {
cmd := ssh.Command(host, command, nil)
var stderrBuf bytes.Buffer
+ cmd.Stdin = strings.
cmd.Stderr = &stderrBuf
err = cmd.Run()
return stderrBuf.String(), err
}
func (e *manualEnviron) Destroy() error { d/*juju* er.TerminationS ignal, agent.DefaultDa taDir), agent.DefaultLo gDir), "+e.envConfig( ).bootstrapHost (), er.TerminationS ignal), "jujud"}, TrimSpace( stderr) ; len(stderr) > 0 {
+ script := `
+set -x
+pkill -%d jujud && exit
+stop juju-db
+rm -f /etc/init/juju*
+rm -f /etc/rsyslog.
+rm -fr %s %s
+exit 0
+`
+ script = fmt.Sprintf(
+ script,
+ terminationwork
+ utils.ShQuote(
+ utils.ShQuote(
+ )
stderr, err := runSSHCommand(
"ubuntu@
- []string{"sudo", "pkill", fmt.Sprintf("-%d",
terminationwork
+ []string{"sudo", "/bin/bash"}, script,
)
if err != nil {
if stderr := strings.
Index: provider/ manual/ environ_ test.go manual/ environ_ test.go' manual/ environ_ test.go 2014-03-18 01:25:52 +0000 manual/ environ_ test.go 2014-03-25 13:18:46 +0000 sting := func(host string, command []string) (string, sting := func(host string, command []string, stdin string)
=== modified file 'provider/
--- provider/
+++ provider/
@@ -84,9 +84,18 @@
func (s *environSuite) TestDestroy(c *gc.C) {
var resultStderr string
var resultErr error
- runSSHCommandTe
error) {
+ runSSHCommandTe
(string, error) {
c.Assert(host, gc.Equals, "ubuntu@hostname")
- c.Assert(command, gc.DeepEquals,
[]string{"sudo", "pkill", "-6", "jujud"})
+ c.Assert(command, gc.DeepEquals,...