Skip to content

Commit 42f2342

Browse files
committed
Updated debug
1 parent 2bcc368 commit 42f2342

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cp.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ func runCp(cmd *Command, args []string) {
5353
// source
5454
source := args[0]
5555
if strings.Index(source, ":") > -1 { // source server address
56+
log.Debugf("Creating a tarball remotely and streaming it using SSH")
5657
serverParts := strings.Split(args[0], ":")
5758
if len(serverParts) != 2 {
5859
log.Fatalf("usage: scw %s", cmd.UsageLine)
@@ -66,6 +67,7 @@ func runCp(cmd *Command, args []string) {
6667
}
6768

6869
dir, base := PathToTARPathparts(serverParts[1])
70+
log.Debugf("Kind of equivalent of 'scp root@%s:%s/%s ...'", server.PublicAddress.IP, dir, base)
6971

7072
// remoteCommand is executed on the remote server
7173
// it streams a tarball raw content
@@ -100,9 +102,10 @@ func runCp(cmd *Command, args []string) {
100102

101103
io.Copy(os.Stderr, tarErrorStream)
102104
} else if source == "-" { // stdin
105+
log.Debugf("Streaming tarball from stdin")
103106
tarOutputStream = os.Stdin
104107
} else { // source host path
105-
log.Debugf("Creating tarball of local path %s", source)
108+
log.Debugf("Taring local path %s", source)
106109
path, err := filepath.Abs(source)
107110
if err != nil {
108111
log.Fatalf("Cannot tar local path: %v", err)
@@ -127,6 +130,7 @@ func runCp(cmd *Command, args []string) {
127130
// destination
128131
destination := args[1]
129132
if strings.Index(destination, ":") > -1 { // destination server address
133+
log.Debugf("Streaming using ssh and untaring remotely")
130134
serverParts := strings.Split(destination, ":")
131135
if len(serverParts) != 2 {
132136
log.Fatalf("usage: scw %s", cmd.UsageLine)
@@ -185,6 +189,7 @@ func runCp(cmd *Command, args []string) {
185189
}
186190

187191
} else { // destination host path
192+
log.Debugf("Untaring to local path: %s", destination)
188193
err := archive.Untar(tarOutputStream, destination, &archive.TarOptions{NoLchown: true})
189194
if err != nil {
190195
log.Fatalf("Failed to untar the remote archive: %v", err)

0 commit comments

Comments
 (0)