mirror of
https://github.com/zrepl/zrepl.git
synced 2024-11-22 08:23:50 +01:00
cmd: remove legacy NoMatchError
This commit is contained in:
parent
70258fbada
commit
7e442ea0ea
@ -1,7 +1,6 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -24,8 +23,6 @@ type datasetMapFilterEntry struct {
|
|||||||
subtreeMatch bool
|
subtreeMatch bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var NoMatchError error = errors.New("no match found in mapping")
|
|
||||||
|
|
||||||
func NewDatasetMapFilter(capacity int, filterOnly bool) DatasetMapFilter {
|
func NewDatasetMapFilter(capacity int, filterOnly bool) DatasetMapFilter {
|
||||||
return DatasetMapFilter{
|
return DatasetMapFilter{
|
||||||
entries: make([]datasetMapFilterEntry, 0, capacity),
|
entries: make([]datasetMapFilterEntry, 0, capacity),
|
||||||
@ -111,7 +108,7 @@ func (m DatasetMapFilter) Map(source *zfs.DatasetPath) (target *zfs.DatasetPath,
|
|||||||
|
|
||||||
mi, hasMapping := m.mostSpecificPrefixMapping(source)
|
mi, hasMapping := m.mostSpecificPrefixMapping(source)
|
||||||
if !hasMapping {
|
if !hasMapping {
|
||||||
err = NoMatchError
|
return nil, nil
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
me := m.entries[mi]
|
me := m.entries[mi]
|
||||||
|
@ -184,11 +184,11 @@ func doPull(pull PullContext) (err error) {
|
|||||||
var localFs *zfs.DatasetPath
|
var localFs *zfs.DatasetPath
|
||||||
localFs, err = pull.Mapping.Map(remoteFilesystems[fs])
|
localFs, err = pull.Mapping.Map(remoteFilesystems[fs])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err != NoMatchError {
|
err := fmt.Errorf("error mapping %s: %s", remoteFilesystems[fs], err)
|
||||||
err := fmt.Errorf("error mapping %s: %s", remoteFilesystems[fs], err)
|
log.Printf("%s", err)
|
||||||
log.Printf("%s", err)
|
return err
|
||||||
return err
|
}
|
||||||
}
|
if localFs == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
log.Printf("%s => %s", remoteFilesystems[fs].ToString(), localFs.ToString())
|
log.Printf("%s => %s", remoteFilesystems[fs].ToString(), localFs.ToString())
|
||||||
|
@ -84,7 +84,11 @@ func doTestDatasetMapFilter(cmd *cobra.Command, args []string) {
|
|||||||
log.Printf("error evaluating mapping: %s", err)
|
log.Printf("error evaluating mapping: %s", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
log.Printf("%s => %s", ip.ToString(), res.ToString())
|
toStr := "NO MAPPING"
|
||||||
|
if res != nil {
|
||||||
|
toStr = res.ToString()
|
||||||
|
}
|
||||||
|
log.Printf("%s => %s", ip.ToString(), toStr)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user