Skip to content

Commit

Permalink
🐛 make sure platform is sent upstream for delayed discovery (#1171)
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Milchev <[email protected]>
  • Loading branch information
imilchev authored Mar 13, 2024
1 parent 13806d6 commit 42cfc70
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions policy/scan/local_scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,10 @@ func handleDelayedDiscovery(ctx context.Context, asset *inventory.Asset, runtime
if err := runtime.Connect(&plugin.ConnectReq{Asset: asset}); err != nil {
return nil, err
}
asset = runtime.Provider.Connection.Asset
slices.Sort(asset.PlatformIds)
asset.KindString = asset.GetPlatform().Kind

if services != nil {
resp, err := services.SynchronizeAssets(ctx, &policy.SynchronizeAssetsReq{
SpaceMrn: spaceMrn,
Expand All @@ -467,12 +471,9 @@ func handleDelayedDiscovery(ctx context.Context, asset *inventory.Asset, runtime
return nil, err
}

asset = runtime.Provider.Connection.Asset
slices.Sort(asset.PlatformIds)
details := resp.Details[asset.PlatformIds[0]]
asset.Mrn = details.AssetMrn
asset.Url = details.Url
asset.KindString = asset.GetPlatform().Kind
asset.Labels["mondoo.com/project-id"] = details.ProjectId
}
return asset, nil
Expand Down

0 comments on commit 42cfc70

Please sign in to comment.