Skip to content

Commit

Permalink
feat(backup/source/dir): Add IgnoreFailedRead to Dir source
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejsika committed Jan 11, 2023
1 parent 4eb5109 commit 260076d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions backup/source/dir/dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import (
)

type DirSource struct {
Path string `yaml:"Path"`
Path string `yaml:"Path"`
IgnoreFailedRead bool `yaml:"IgnoreFailedRead"`
}

func (s DirSource) Validate() error {
Expand All @@ -34,11 +35,15 @@ func (s DirSource) Backup() (backup_output.BackupOutput, error) {
}
defer os.Remove(f.Name())

args := []string{}
if s.IgnoreFailedRead {
args = append(args, "--ignore-failed-read")
}
args = append(args, []string{"-cf", f.Name(), s.Path}...)

tmpBo, err := backup_process_utils.BackupProcessExecToFile(
"tar",
"-cf",
f.Name(),
s.Path,
args...,
)
if err != nil {
return tmpBo, err
Expand Down

0 comments on commit 260076d

Please sign in to comment.