Skip to content

Commit

Permalink
fixup! RHINENG-2284: updated evaluation to store data in {system_pack…
Browse files Browse the repository at this point in the history
…age,package_system}_data tables
  • Loading branch information
MichaelMraka committed Oct 25, 2023
1 parent 33dac6e commit aca7485
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions evaluator/evaluate_packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func loadSystemNEVRAsFromDB(tx *gorm.DB, system *models.SystemPlatform,
updatable++
}
pkgMeta, ok := memoryPackageCache.GetByNevra(nevra)
pkgUpdateData := packageUpdateData(availableUpdates)
pkgUpdateData := packageUpdateData(pkgMeta.Evra, availableUpdates)
// before we used nevra.EVRAString() function which shows only non zero epoch, keep it consistent
// maybe we need here something like: evra := strings.TrimPrefix(upData.GetEVRA(), "0:")
if ok {
Expand Down Expand Up @@ -214,15 +214,16 @@ func loadSystemNEVRAsFromDB(tx *gorm.DB, system *models.SystemPlatform,
return packages, installed, updatable, err
}

func packageUpdateData(availableUpdates []vmaas.UpdatesV3ResponseAvailableUpdates) models.PackageUpdateData {
data := models.PackageUpdateData{}
func packageUpdateData(installedEvra string,
availableUpdates []vmaas.UpdatesV3ResponseAvailableUpdates) models.PackageUpdateData {
data := models.PackageUpdateData{Installed: installedEvra}
for _, p := range availableUpdates {
if p.Package != nil {
switch p.StatusID {
case APPLICABLE:
data.Applicable = *p.Package
data.Applicable = *p.EVRA
case INSTALLABLE:
data.Installable = *p.Package
data.Installable = *p.EVRA
}
}
}
Expand Down

0 comments on commit aca7485

Please sign in to comment.