Skip to content

Commit

Permalink
store/fleetdb: copy inbandInstall, Oem bool values from firmware set …
Browse files Browse the repository at this point in the history
…response

The InbandInstall bool is required for flasher inband to plan and
execute the inband install
  • Loading branch information
joelrebel committed Aug 22, 2024
1 parent 66e65d1 commit 5ae1da9
Showing 1 changed file with 30 additions and 10 deletions.
40 changes: 30 additions & 10 deletions internal/store/fleetdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,18 +313,38 @@ func intoFirmwaresSlice(componentFirmware []fleetdbapi.ComponentFirmwareVersion)

firmwares := make([]*model.Firmware, 0, len(componentFirmware))

booleanIsTrue := func(b *bool) bool {
if b != nil && *b {
return true
}

return false
}

// nolint:gocritic // rangeValCopy - componentFirmware is returned by fleetdb API in this form.
for _, firmware := range componentFirmware {
firmwares = append(firmwares, &model.Firmware{
ID: firmware.UUID.String(),
Vendor: strings.ToLower(firmware.Vendor),
Models: strSliceToLower(firmware.Model),
FileName: firmware.Filename,
Version: firmware.Version,
Component: strings.ToLower(firmware.Component),
Checksum: firmware.Checksum,
URL: firmware.RepositoryURL,
})
fw := &model.Firmware{
ID: firmware.UUID.String(),
Vendor: strings.ToLower(firmware.Vendor),
Models: strSliceToLower(firmware.Model),
FileName: firmware.Filename,
Version: firmware.Version,
Component: strings.ToLower(firmware.Component),
Checksum: firmware.Checksum,
URL: firmware.RepositoryURL,
InstallInband: *firmware.InstallInband,
Oem: *firmware.OEM,
}

if booleanIsTrue(firmware.InstallInband) {
fw.InstallInband = true
}

if booleanIsTrue(firmware.OEM) {
fw.Oem = true
}

firmwares = append(firmwares, fw)
}

return firmwares
Expand Down

0 comments on commit 5ae1da9

Please sign in to comment.