func sendViaScp(file, host, destFile string) error { err := ssh.Copy([]string{file, "ubuntu@" + host + ":" + destFile}, nil) if err != nil { return errors.Annotate(err, "scp command failed") } return nil }
func sendViaScp(file, host, destFile string) error { err := ssh.Copy([]string{file, "ubuntu@" + host + ":" + destFile}, nil) if err != nil { return fmt.Errorf("scp command failed: %v", err) } return nil }
// Run resolves c.Target to a machine, or host of a unit and // forks ssh with c.Args, if provided. func (c *SCPCommand) Run(ctx *cmd.Context) error { var err error c.apiClient, err = c.initAPIClient() if err != nil { return err } defer c.apiClient.Close() options, err := c.getSSHOptions(false) if err != nil { return err } args, err := expandArgs(c.Args, c.hostFromTarget) if err != nil { return err } return ssh.Copy(args, options) }