MCPcopy Create free account
hub / github.com/DBCDK/morph / UploadFile

Method UploadFile

ssh/ssh.go:324–341  ·  view source on GitHub ↗
(host Host, source string, destination string)

Source from the content-addressed store, hash-verified

322}
323
324func (ctx *SSHContext) UploadFile(host Host, source string, destination string) (err error) {
325 c, parts := ctx.sshArgs(host, &FileTransfer{
326 Source: source,
327 Destination: destination,
328 })
329 cmd := exec.Command(c, parts...)
330
331 data, err := cmd.CombinedOutput()
332 if err != nil {
333 errorMessage := fmt.Sprintf(
334 "Error on remote host %s (%s):\nCouldn't upload file: %s -> %s\n\nOriginal error:\n%s",
335 host.GetName(), host.GetTargetHost(), source, destination, string(data),
336 )
337 return errors.New(errorMessage)
338 }
339
340 return nil
341}
342
343func (ctx *SSHContext) MakeDirs(host Host, path string, parents bool, mode os.FileMode) (err error) {
344

Callers

nothing calls this directly

Calls 3

sshArgsMethod · 0.95
GetNameMethod · 0.65
GetTargetHostMethod · 0.65

Tested by

no test coverage detected