Skip to content

Commit

Permalink
🐛 use resolved asset (#783)
Browse files Browse the repository at this point in the history
During the resolution, if we only use the (old) asset object, we miss
the part where cnquery fixes the `Backend` field. See: mondoohq/cnquery#2021

Signed-off-by: Dominik Richter <[email protected]>
  • Loading branch information
arlimus authored Oct 2, 2023
1 parent ad283e0 commit 93682b7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
13 changes: 12 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 3 additions & 4 deletions policy/scan/local_scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 93682b7

Please sign in to comment.