From 42cfc70847c547b803d61be6309eb8093b2b327c Mon Sep 17 00:00:00 2001 From: Ivan Milchev Date: Wed, 13 Mar 2024 13:51:40 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20make=20sure=20platform=20is=20se?= =?UTF-8?q?nt=20upstream=20for=20delayed=20discovery=20(#1171)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ivan Milchev --- policy/scan/local_scanner.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/policy/scan/local_scanner.go b/policy/scan/local_scanner.go index 8aa71d89..ff70d0e6 100644 --- a/policy/scan/local_scanner.go +++ b/policy/scan/local_scanner.go @@ -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, @@ -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