Skip to content

Commit

Permalink
suppress error message of remote sync and hide context cancel recursi…
Browse files Browse the repository at this point in the history
…ve logging
  • Loading branch information
umputun committed May 18, 2023
1 parent 0d52aa2 commit d4330d0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/executor/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ func (ex *Remote) getRemoteFilesProperties(ctx context.Context, dir string, excl
var processEntry func(ctx context.Context, client *sftp.Client, root string, excl []string, dir string) error

processEntry = func(ctx context.Context, client *sftp.Client, root string, excl []string, dir string) error {
log.Printf("[DEBUG] processing remote directory %s", dir)
select {
case <-ctx.Done():
return ctx.Err()
Expand All @@ -455,7 +456,7 @@ func (ex *Remote) getRemoteFilesProperties(ctx context.Context, dir string, excl
fullPath := filepath.Join(dir, entry.Name())
relPath, err := filepath.Rel(root, fullPath)
if err != nil {
log.Printf("[ERROR] failed to get relative path for %s: %v", fullPath, err)
log.Printf("[WARN] failed to get relative path for %s: %v", fullPath, err)
continue
}

Expand All @@ -465,8 +466,8 @@ func (ex *Remote) getRemoteFilesProperties(ctx context.Context, dir string, excl

if entry.IsDir() {
err := processEntry(ctx, client, root, excl, fullPath)
if err != nil {
log.Printf("[ERROR] failed to process directory %s: %v", fullPath, err)
if err != nil && err.Error() != "context canceled" {
log.Printf("[WARN] failed to process directory %s: %v", fullPath, err)
}
continue
}
Expand Down

0 comments on commit d4330d0

Please sign in to comment.