mirror of
https://github.com/zrepl/zrepl.git
synced 2024-11-25 01:44:43 +01:00
zfs: ZFSListMapping fix broken logic
This commit is contained in:
parent
cb37470010
commit
44d20ac256
@ -21,9 +21,9 @@ func ZFSListMapping(mapping DatasetMapping) (datasets []DatasetPath, err error)
|
|||||||
var lines [][]string
|
var lines [][]string
|
||||||
lines, err = ZFSList([]string{"name"}, "-r", "-t", "filesystem,volume")
|
lines, err = ZFSList([]string{"name"}, "-r", "-t", "filesystem,volume")
|
||||||
|
|
||||||
datasets = make([]DatasetPath, len(lines))
|
datasets = make([]DatasetPath, 0, len(lines))
|
||||||
|
|
||||||
for i, line := range lines {
|
for _, line := range lines {
|
||||||
|
|
||||||
var path DatasetPath
|
var path DatasetPath
|
||||||
if path, err = NewDatasetPath(line[0]); err != nil {
|
if path, err = NewDatasetPath(line[0]); err != nil {
|
||||||
@ -31,12 +31,12 @@ func ZFSListMapping(mapping DatasetMapping) (datasets []DatasetPath, err error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
_, mapErr := mapping.Map(path)
|
_, mapErr := mapping.Map(path)
|
||||||
if mapErr != nil && err != NoMatchError {
|
if mapErr != nil && mapErr != NoMatchError {
|
||||||
return nil, err
|
return nil, mapErr
|
||||||
}
|
}
|
||||||
|
|
||||||
if mapErr == nil {
|
if mapErr == nil {
|
||||||
datasets[i] = path
|
datasets = append(datasets, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user