Skip to content

Commit

Permalink
final edition of CopyDir command, use rsync
Browse files Browse the repository at this point in the history
  • Loading branch information
twalluxio committed Aug 22, 2023
1 parent d385269 commit 7aa1ce0
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions cli/src/alluxio.org/cli/cmd/initiate/copy_dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"fmt"
"os"
"os/exec"
"os/user"
"path/filepath"
"strings"

Expand Down Expand Up @@ -53,12 +52,6 @@ func (c *CopyDirCommand) ToCommand() *cobra.Command {
return stacktrace.Propagate(err, "cannot find absolute path")
}

// hypothesize all hosts use the same username
cu, err := user.Current()
if err != nil {
return stacktrace.Propagate(err, "cannot find current user")
}

var errs []error
for _, host := range hosts {
if host == myHost {
Expand All @@ -77,7 +70,7 @@ func (c *CopyDirCommand) ToCommand() *cobra.Command {
}

cmd := exec.Command("rsync", "-az", srcDir,
fmt.Sprintf("%s@%s:%s", cu.Username, host, dstDir))
fmt.Sprintf("%s:%s", host, dstDir))
log.Logger.Infof("Command: %s", cmd)
if err := cmd.Run(); err != nil {
log.Logger.Error("Error: %s", err)
Expand Down

0 comments on commit 7aa1ce0

Please sign in to comment.