Skip to content

Commit

Permalink
list/firmware: set model value only when defined
Browse files Browse the repository at this point in the history
Or we end up searching for an empty list of models which returns no data
  • Loading branch information
joelrebel committed Apr 8, 2024
1 parent 6b0ba82 commit 46f6a05
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions cmd/list/firmware.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,22 @@ var listFirmware = &cobra.Command{
}

filterParams := fleetdbapi.ComponentFirmwareVersionListParams{
Vendor: strings.ToLower(flagsDefinedListFirmware.vendor),
// TODO - if we really want to search using multiple models
//
// fix the the firmware search in fleetdb, its currently useless
// because fleetdb queries the data using an 'AND' instead of an 'OR'
Model: []string{strings.ToLower(flagsDefinedListFirmware.model)},
Vendor: strings.ToLower(flagsDefinedListFirmware.vendor),
Version: flagsDefinedListFirmware.version,
Pagination: &fleetdbapi.PaginationParams{
Limit: flagsDefinedListFirmware.limit,
Page: flagsDefinedListFirmware.page,
},
}

if flagsDefinedListFirmware.model != "" {
// TODO - if we really want to search using multiple models
//
// fix the the firmware search in fleetdb, its currently useless
// because fleetdb queries the data using an 'AND' instead of an 'OR'
filterParams.Model = []string{strings.ToLower(flagsDefinedListFirmware.model)}
}

firmware, _, err := client.ListServerComponentFirmware(ctx, &filterParams)
if err != nil {
log.Fatal("fleetdb API client returned error: ", err)
Expand Down

0 comments on commit 46f6a05

Please sign in to comment.