diff --git a/Dockerfile b/Dockerfile index 339da40..d928200 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,5 @@ RUN apt-get update \ && apt-get install -y --no-install-recommends \ golang-go \ zfsutils-linux \ - && rm -rf /var/lib/apt/lists/* \ - && /sbin/modprobe zfs + && rm -rf /var/lib/apt/lists/* diff --git a/zfs.go b/zfs.go index fb1b4cc..18e382e 100644 --- a/zfs.go +++ b/zfs.go @@ -54,11 +54,8 @@ func (lo ListOptions) propertySourceStrings() []string { // ListDatasets lists the datasets by type and allows you to fetch extra custom fields func ListDatasets(ctx context.Context, options ListOptions) ([]Dataset, error) { - allFields := append(dsPropList, options.ExtraProperties...) // nolint: gocritic - dsPropListOptions := strings.Join(allFields, ",") - args := make([]string, 0, 16) - args = append(args, "list", "-Hp", "-o", dsPropListOptions) + args = append(args, "get", "-Hp") if options.DatasetType != "" { args = append(args, "-t", string(options.DatasetType)) } @@ -75,6 +72,10 @@ func ListDatasets(ctx context.Context, options ListOptions) ([]Dataset, error) { args = append(args, "-s", strings.Join(options.propertySourceStrings(), ",")) } + allFields := append(dsPropList, options.ExtraProperties...) // nolint: gocritic + dsPropListOptions := strings.Join(allFields, ",") + args = append(args, dsPropListOptions) + if options.ParentDataset != "" { args = append(args, options.ParentDataset) }