Skip to content

Commit

Permalink
cmd/common/FirmwareSetByVendorModel: verify vendor, model attribues a…
Browse files Browse the repository at this point in the history
…re set before lookup
  • Loading branch information
joelrebel committed Nov 14, 2023
1 parent 575fe0a commit 28d8654
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cmd/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,22 @@ func FirmwareSetIDByVendorModel(ctx context.Context, vendor, model string, clien
//
// TODO: move into common library
func FirmwareSetByVendorModel(ctx context.Context, vendor, model string, client *serverservice.Client) ([]serverservice.ComponentFirmwareSet, error) {
vendor = strings.TrimSpace(vendor)
if vendor == "" {
return []serverservice.ComponentFirmwareSet{}, errors.Wrap(
ErrFwSetByVendorModel,
fmt.Sprintf("got empty vendor attribute"),
)
}

model = strings.TrimSpace(model)
if model == "" {
return []serverservice.ComponentFirmwareSet{}, errors.Wrap(
ErrFwSetByVendorModel,
fmt.Sprintf("got empty model attribute"),
)
}

// ?attr=sh.hollow.firmware_set.labels~vendor~eq~dell&attr=sh.hollow.firmware_set.labels~model~eq~r750&attr=sh.hollow.firmware_set.labels~latest~eq~false
// list latest, default firmware sets by vendor, model attributes
fwSetListparams := &serverservice.ComponentFirmwareSetListParams{
Expand Down

0 comments on commit 28d8654

Please sign in to comment.