Merge lp:~axwalk/juju-core/utils-ssh-stat-default-identities 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: | 2304 |
Proposed branch: | lp:~axwalk/juju-core/utils-ssh-stat-default-identities |
Merge into: | lp:~go-bot/juju-core/trunk |
Diff against target: |
41 lines (+11/-3) 2 files modified
utils/ssh/ssh_openssh.go (+3/-1) utils/ssh/ssh_test.go (+8/-2) |
To merge this branch: | bzr merge lp:~axwalk/juju-core/utils-ssh-stat-default-identities |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+204832@code.launchpad.net |
Commit message
utils/ssh: only use existing default identities
"juju ssh" and bootstrap and so on are emitting
warnings from ssh if any of the default identities
don't exist. This is fixed by only specifying the
default identities that exist.
Description of the change
utils/ssh: only use existing default identities
"juju ssh" and bootstrap and so on are emitting
warnings from ssh if any of the default identities
don't exist. This is fixed by only specifying the
default identities that exist.
To post a comment you must log in.
Reviewers: mp+204832_ code.launchpad. net,
Message:
Please take a look.
Description:
utils/ssh: only use existing default identities
"juju ssh" and bootstrap and so on are emitting
warnings from ssh if any of the default identities
don't exist. This is fixed by only specifying the
default identities that exist.
https:/ /code.launchpad .net/~axwalk/ juju-core/ utils-ssh- stat-default- identities/ +merge/ 204832
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/52230047/
Affected files (+13, -3 lines): ssh_openssh. go ssh_test. go
A [revision details]
M utils/ssh/
M utils/ssh/
Index: [revision details] 20140204193125- k8xmn7d6lr3zswn w
=== 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: utils/ssh/ ssh_openssh. go ssh/ssh_ openssh. go' ssh_openssh. go 2014-02-04 03:12:33 +0000 ssh_openssh. go 2014-02-05 08:48:40 +0000 Warningf( "failed to normalize path %q: %v", identity, err)
=== modified file 'utils/
--- utils/ssh/
+++ utils/ssh/
@@ -88,7 +88,9 @@
logger.
continue
}
- identities = append(identities, path)
+ if _, err := os.Stat(path); err == nil {
+ identities = append(identities, path)
+ }
}
}
for _, identity := range identities {
Index: utils/ssh/ ssh_test. go ssh/ssh_ test.go' ssh_test. go 2014-02-04 03:12:33 +0000 ssh_test. go 2014-02-05 08:48:40 +0000
=== modified file 'utils/
--- utils/ssh/
+++ utils/ssh/
@@ -151,14 +151,20 @@
func (s *SSHCommandSuite) TestCommandDefa ultIdentities( c *gc.C) { ssh.DefaultIden tities, []string{"def1", "def2"}) Join(tempdir, "def1") Join(tempdir, "def2") ssh.DefaultIden tities, []string{def1, def2}) andArgs( c, s.commandOption s([]string{ "echo", "123"}, &opts), ecking no -o PasswordAuthent ication no WriteFile( def2, nil, 0644) SetIdentities( "x", "y") andArgs( c, s.commandOption s([]string{ "echo", "123"}, &opts), ecking no -o PasswordAuthent ication no -i ecking no -o PasswordAuthent ication no -i
var opts ssh.Options
- s.PatchValue(
+ tempdir := c.MkDir()
+ def1 := filepath.
+ def2 := filepath.
+ s.PatchValue(
// If no identities are specified, then the defaults aren't added.
s.assertComm
s.fakessh+" -o StrictHostKeyCh
localhost -- echo 123",
)
// If identities are specified, then the defaults are must added.
+ // Only the defaults that exist on disk will be added.
+ err := ioutil.
+ c.Assert(err, gc.IsNil)
opts.
s.assertComm
- s.fakessh+" -o StrictHostKeyCh
x -i y -i def1 -i def2 localhost -- echo 123",
+ s.fakessh+" -o StrictHostKeyCh
x -i y -i "+def2+" localhost -- echo 123",
)
}