Skip to content

Commit

Permalink
fix: check all platform mrns
Browse files Browse the repository at this point in the history
  • Loading branch information
slntopp committed Nov 26, 2024
1 parent 457c08f commit 448911a
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions policy/scan/local_scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,18 +372,23 @@ func (s *LocalScanner) distributeJob(job *Job, ctx context.Context, upstream *up
cur := batch[i]
asset := cur.Asset
log.Debug().Str("asset", asset.Name).Strs("platform-ids", asset.PlatformIds).Msg("update asset")
platformMrn := asset.PlatformIds[0]
if details, ok := platformAssetMapping[platformMrn]; ok {
asset.Mrn = details.AssetMrn
asset.Url = details.Url
asset.Labels["mondoo.com/project-id"] = details.ProjectId
err = cur.Runtime.SetRecording(s.recording)
if err != nil {
// we do not want to stop the scan if we cannot set the recording
log.Error().Err(err).Msg("could not set recording")

for _, platformMrn := range asset.PlatformIds {
if details, ok := platformAssetMapping[platformMrn]; ok {
asset.Mrn = details.AssetMrn
asset.Url = details.Url
asset.Labels["mondoo.com/project-id"] = details.ProjectId
err = cur.Runtime.SetRecording(s.recording)
if err != nil {
// we do not want to stop the scan if we cannot set the recording
log.Error().Err(err).Msg("could not set recording")
break
}
cur.Runtime.AssetUpdated(asset)
break
}
cur.Runtime.AssetUpdated(asset)
}

}
} else {
// ensure we have non-empty asset MRNs
Expand Down

0 comments on commit 448911a

Please sign in to comment.