Skip to content

Commit

Permalink
RHINENG-8141: minor improvements and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Dugowitch committed Aug 7, 2024
1 parent ac7d368 commit 8120c22
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions evaluator/evaluate_advisories.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ func loadMissingNamesIDs(missingNames []string, extendedAdvisories *extendedAdvi
return err
}

name2AdvisoryID := make(map[string]int64, len(missingNames))
name2AdvisoryID := make(map[string]int64, len(advisoryMetadata))
for _, am := range advisoryMetadata {
name2AdvisoryID[am.Name] = am.ID
}

for _, name := range missingNames {
if _, found := name2AdvisoryID[name]; !found {
return errors.New("Failed to evaluate changes because an advisory was not lazy-saved")
return errors.New("Failed to evaluate changes because an advisory was not lazy saved")
}
extendedAdvisory := (*extendedAdvisories)[name]
extendedAdvisory.AdvisoryID = name2AdvisoryID[name]
Expand Down Expand Up @@ -135,12 +135,11 @@ func lazySaveAdvisories(vmaasData *vmaas.UpdatesV3Response, inventoryID string)
}

nUnknown := len(missingNames)
if nUnknown > 0 {
utils.LogInfo("inventoryID", inventoryID, "unknown", nUnknown, "unknown advisories")
updatesCnt.WithLabelValues("unknown").Add(float64(nUnknown))
} else {
if nUnknown <= 0 {
return nil
}
utils.LogInfo("inventoryID", inventoryID, "unknown", nUnknown, "unknown advisories")
updatesCnt.WithLabelValues("unknown").Add(float64(nUnknown))

err = storeMissingAdvisories(missingNames)
if err != nil {
Expand Down Expand Up @@ -223,7 +222,6 @@ func storeAdvisoryData(tx *gorm.DB, system *models.SystemPlatform, advisoriesByN
return nil, errors.Wrap(err, "Unable to update system advisories")
}

// FIXME: Advisory account data should calculate changes from the before-update data
err = updateAdvisoryAccountData(tx, system, deleteIDs, systemAdvisoriesNew)
if err != nil {
return nil, errors.Wrap(err, "Unable to update advisory_account_data caches")
Expand Down

0 comments on commit 8120c22

Please sign in to comment.