Skip to content

Commit

Permalink
Use zfs get
Browse files Browse the repository at this point in the history
  • Loading branch information
vansante committed Mar 20, 2024
1 parent 53a89a4 commit c8753c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/*

9 changes: 5 additions & 4 deletions zfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand All @@ -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)
}
Expand Down

0 comments on commit c8753c7

Please sign in to comment.