(host Host)
| 300 | } |
| 301 | |
| 302 | func (ctx *SSHContext) MakeTempFile(host Host) (path string, err error) { |
| 303 | cmd, _ := ctx.Cmd(host, "mktemp") |
| 304 | |
| 305 | var stdout bytes.Buffer |
| 306 | var stderr bytes.Buffer |
| 307 | cmd.Stdout = &stdout |
| 308 | cmd.Stderr = &stderr |
| 309 | |
| 310 | err = cmd.Run() |
| 311 | if err != nil { |
| 312 | errorMessage := fmt.Sprintf( |
| 313 | "Error on remote host %s (%s):\nCouldn't create temporary file using mktemp\n\nOriginal error:\n%s", |
| 314 | host.GetName(), host.GetTargetHost(), stderr.String(), |
| 315 | ) |
| 316 | return "", errors.New(errorMessage) |
| 317 | } |
| 318 | |
| 319 | tempFile := strings.TrimSpace(stdout.String()) |
| 320 | |
| 321 | return tempFile, nil |
| 322 | } |
| 323 | |
| 324 | func (ctx *SSHContext) UploadFile(host Host, source string, destination string) (err error) { |
| 325 | c, parts := ctx.sshArgs(host, &FileTransfer{ |
nothing calls this directly
no test coverage detected