OLD | NEW |
1 // Copyright 2013 Canonical Ltd. | 1 // Copyright 2013 Canonical Ltd. |
2 // Licensed under the AGPLv3, see LICENCE file for details. | 2 // Licensed under the AGPLv3, see LICENCE file for details. |
3 | 3 |
4 // Package ssh contains utilities for dealing with SSH connections, | 4 // Package ssh contains utilities for dealing with SSH connections, |
5 // key management, and so on. All SSH-based command executions in | 5 // key management, and so on. All SSH-based command executions in |
6 // Juju should use the Command/ScpCommand functions in this package. | 6 // Juju should use the Command/ScpCommand functions in this package. |
7 // | 7 // |
8 package ssh | 8 package ssh |
9 | 9 |
10 import ( | 10 import ( |
11 "bytes" | 11 "bytes" |
12 "errors" | |
13 "io" | 12 "io" |
14 "os/exec" | 13 "os/exec" |
15 "syscall" | 14 "syscall" |
16 | 15 |
| 16 "github.com/juju/errgo/errors" |
| 17 |
17 "launchpad.net/juju-core/cmd" | 18 "launchpad.net/juju-core/cmd" |
18 ) | 19 ) |
19 | 20 |
20 // Options is a client-implementation independent SSH options set. | 21 // Options is a client-implementation independent SSH options set. |
21 type Options struct { | 22 type Options struct { |
22 // ssh server port; zero means use the default (22) | 23 // ssh server port; zero means use the default (22) |
23 port int | 24 port int |
24 // no PTY forced by default | 25 // no PTY forced by default |
25 allocatePTY bool | 26 allocatePTY bool |
26 // password authentication is disallowed by default | 27 // password authentication is disallowed by default |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 func Command(host string, command []string, options *Options) *Cmd { | 226 func Command(host string, command []string, options *Options) *Cmd { |
226 logger.Debugf("using %s ssh client", chosenClient) | 227 logger.Debugf("using %s ssh client", chosenClient) |
227 return DefaultClient.Command(host, command, options) | 228 return DefaultClient.Command(host, command, options) |
228 } | 229 } |
229 | 230 |
230 // Copy is a short-cut for DefaultClient.Copy. | 231 // Copy is a short-cut for DefaultClient.Copy. |
231 func Copy(targets, extraArgs []string, options *Options) error { | 232 func Copy(targets, extraArgs []string, options *Options) error { |
232 logger.Debugf("using %s ssh client", chosenClient) | 233 logger.Debugf("using %s ssh client", chosenClient) |
233 return DefaultClient.Copy(targets, extraArgs, options) | 234 return DefaultClient.Copy(targets, extraArgs, options) |
234 } | 235 } |
OLD | NEW |