From 46f6a05228b470dac3c355a5a117cd7b94df2020 Mon Sep 17 00:00:00 2001 From: Joel Rebello Date: Fri, 5 Apr 2024 10:03:16 +0200 Subject: [PATCH] list/firmware: set model value only when defined Or we end up searching for an empty list of models which returns no data --- cmd/list/firmware.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/cmd/list/firmware.go b/cmd/list/firmware.go index 95e570e0..4deaf7b8 100644 --- a/cmd/list/firmware.go +++ b/cmd/list/firmware.go @@ -44,12 +44,7 @@ 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, @@ -57,6 +52,14 @@ var listFirmware = &cobra.Command{ }, } + 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)