Merge lp:~axwalk/juju-core/lp1298115-utils-ssh-testing 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: | 2497 | ||||
Proposed branch: | lp:~axwalk/juju-core/lp1298115-utils-ssh-testing | ||||
Merge into: | lp:~go-bot/juju-core/trunk | ||||
Diff against target: |
121 lines (+13/-45) 1 file modified
utils/ssh/ssh_openssh.go (+13/-45) |
||||
To merge this branch: | bzr merge lp:~axwalk/juju-core/lp1298115-utils-ssh-testing | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+212977@code.launchpad.net |
Commit message
utils/ssh: revert to using slices for command args
Reverts part of https:/
which changed OpenSSH-based client args from using a slice
to a map.
Fixes lp:1298115
Description of the change
utils/ssh: revert to using slices for command args
Reverts part of https:/
which changed OpenSSH-based client args from using a slice
to a map.
Fixes lp:1298115
To post a comment you must log in.
Reviewers: mp+212977_ code.launchpad. net,
Message:
Please take a look.
Description:
utils/ssh: revert to using slices for command args
Reverts part of https:/ /codereview. appspot. com/66340045/
which changed OpenSSH-based client args from using a slice
to a map.
Fixes lp:1298115
https:/ /code.launchpad .net/~axwalk/ juju-core/ lp1298115- utils-ssh- testing/ +merge/ 212977
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/81180043/
Affected files (+15, -45 lines): ssh_openssh. go
A [revision details]
M utils/ssh/
Index: [revision details] 20140326230643- olixj5ukxzhgt4c v
=== 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-03-19 03:18:41 +0000 ssh_openssh. go 2014-03-27 02:42:08 +0000 net/juju- core/utils"
=== modified file 'utils/
--- utils/ssh/
+++ utils/ssh/
@@ -14,7 +14,7 @@
"launchpad.
)
-var opensshCommonOp tions = map[string] []string{ "-o": "StrictHostKeyC hecking no"}} tions = []string{"-o", "StrictHostKeyC hecking no"}
[]string{
+var opensshCommonOp
// default identities will not be attempted if
// -i is specified and they are not explcitly
@@ -63,22 +63,19 @@
return &c, nil
}
-func opensshOptions( options *Options, commandKind opensshCommandKind) string] []string) tions { options *Options, commandKind opensshCommandKind) tions.. .) proxyCommand) > 0 { CommandString( options. proxyCommand. ..)) CommandString( options. proxyCommand. ..)) passwordAuthAll owed { tication no") tication no") identities. ..) options. port)
map[string][]string {
- args := make(map[
- for k, v := range opensshCommonOp
- args[k] = v
- }
+func opensshOptions(
[]string {
+ args := append([]string{}, opensshCommonOp
if options == nil {
options = &Options{}
}
if len(options.
- args["-o"] =
append(args["-o"], "ProxyCommand "+utils.
+ args =
append(args, "-o", "ProxyCommand "+utils.
}
if !options.
- args["-o"] = append(args["-o"], "PasswordAuthen
+ args = append(args, "-o", "PasswordAuthen
}
if options.allocatePTY {
- args["-t"] = []string{}
+ args = append(args, "-t", "-t") // twice to force
}
identities := append([]string{}, options.
if pk := PrivateKeyFiles(); len(pk) > 0 {
@@ -100,54 +97,29 @@
}
}
for _, identity := range identities {
- args["-i"] = append(args["-i"], identity)
+ args = append(args, "-i", identity)
}
if options.port != 0 {
port := fmt.Sprint(
if commandKind == scpKind {
// scp uses -P instead of -p (-p means preserve).
- args["-P"] = []string{port}
+ args = append(args, "-P", port)
} else {
- args["-p"] = []string{port}
+ args = append(args, "-p", port)
}
}
return args
}
-func expandArgs(args map[string] []string, quote bool) []string {
- var list []string
- for opt, vals := range args {
- if len(vals) == 0 {
- list = append(list, opt)
- if opt == "-t" {
- // In order to force a PTY to be allocated, we need to
- // pass -t twice.
- ...