Skip to content

Commit

Permalink
ignore some zfs create error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
dmke committed Aug 20, 2024
1 parent 3d10e1d commit 7ddf8e7
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion zfs/transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package zfs

import (
"bytes"
"errors"
"fmt"
"io"
"log"
Expand Down Expand Up @@ -212,7 +213,14 @@ func DoSync(from, to *Fs, flags Flags) error {
// ensure the filesystem exists
toChild, err := to.CreateIfMissing(fromChild.name)
if err != nil {
return err
var exitErr *exec.ExitError
ignore := false
if errors.As(err, &exitErr) {
ignore = canIgnoreCreateError(string(exitErr.Stderr))
}
if !ignore {
return err
}
}
err = DoSync(fromChild, toChild, flags)
if err != nil {
Expand All @@ -223,3 +231,8 @@ func DoSync(from, to *Fs, flags Flags) error {

return nil
}

func canIgnoreCreateError(msg string) bool {
return strings.Contains(msg, "successfully created, but not mounted") ||
strings.Contains(msg, "filesystem successfully created, but it may only be mounted by root")
}

0 comments on commit 7ddf8e7

Please sign in to comment.