From 93682b763b5f6e4f40853c8e7a2a59da967cc7e9 Mon Sep 17 00:00:00 2001 From: Dominik Richter Date: Mon, 2 Oct 2023 04:37:12 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20use=20resolved=20asset=20(#783)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit During the resolution, if we only use the (old) asset object, we miss the part where cnquery fixes the `Backend` field. See: https://github.com/mondoohq/cnquery/pull/2021 Signed-off-by: Dominik Richter --- .vscode/launch.json | 13 ++++++++++++- policy/scan/local_scanner.go | 7 +++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 01b2d09d..2512c590 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -69,7 +69,18 @@ } }, { - "name": "serve", + "name": "Serve", + "type": "go", + "request": "launch", + "program": "${workspaceRoot}/apps/cnspec/cnspec.go", + "cwd": "${workspaceRoot}/", + "args": [ + "serve", + // "--verbose" + ] + }, + { + "name": "serve-api", "type": "go", "request": "launch", "program": "${workspaceRoot}/apps/cnspec/cnspec.go", diff --git a/policy/scan/local_scanner.go b/policy/scan/local_scanner.go index 11b1b046..ee535586 100644 --- a/policy/scan/local_scanner.go +++ b/policy/scan/local_scanner.go @@ -232,15 +232,14 @@ func (s *LocalScanner) distributeJob(job *Job, ctx context.Context, upstream *up // we connect and perform discovery for each asset in the job inventory for i := range assetList { - asset := assetList[i] - resolvedAsset, err := im.ResolveAsset(asset) + resolvedAsset, err := im.ResolveAsset(assetList[i]) if err != nil { return nil, false, err } - runtime, err := providers.Coordinator.RuntimeFor(asset, providers.DefaultRuntime()) + runtime, err := providers.Coordinator.RuntimeFor(resolvedAsset, providers.DefaultRuntime()) if err != nil { - log.Error().Err(err).Str("asset", asset.Name).Msg("unable to create runtime for asset") + log.Error().Err(err).Str("asset", resolvedAsset.Name).Msg("unable to create runtime for asset") continue } runtime.SetRecording(s.recording)