Skip to content

Commit

Permalink
🧹 Respect inventory-file if passed in. (#740)
Browse files Browse the repository at this point in the history
Respects the `--inventory-file` flag if that's passed in.
  • Loading branch information
preslavgerchev authored Sep 20, 2023
1 parent 114dec3 commit c32a2de
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions apps/cnspec/cmd/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"go.mondoo.com/cnquery"
"go.mondoo.com/cnquery/cli/config"
"go.mondoo.com/cnquery/cli/execruntime"
"go.mondoo.com/cnquery/cli/inventoryloader"
"go.mondoo.com/cnquery/cli/theme"
"go.mondoo.com/cnquery/providers"
"go.mondoo.com/cnquery/providers-sdk/v1/inventory"
Expand Down Expand Up @@ -164,14 +165,14 @@ func getCobraScanConfig(cmd *cobra.Command, runtime *providers.Runtime, cliRes *
log.Fatal().Err(err).Msg("failed to parse props")
}

inv, err := inventoryloader.ParseOrUse(cliRes.Asset, viper.GetBool("insecure"))
if err != nil {
log.Fatal().Err(err).Msg("failed to parse inventory")
}
conf := scanConfig{
Features: opts.GetFeatures(),
IsIncognito: viper.GetBool("incognito"),
Inventory: &inventory.Inventory{
Spec: &inventory.InventorySpec{
Assets: []*inventory.Asset{cliRes.Asset},
},
},
Inventory: inv,
PolicyPaths: viper.GetStringSlice("policy-bundle"),
PolicyNames: viper.GetStringSlice("policies"),
Props: props,
Expand Down

0 comments on commit c32a2de

Please sign in to comment.