Skip to content

Commit

Permalink
🧹Update usage of inventory manager api (#334)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaym authored Feb 7, 2023
1 parent 66d95ae commit 8859c4d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions apps/cnspec/cmd/vuln.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ configure your Azure credentials and have SSH access to your virtual machines.`,
ctx := discovery.InitCtx(context.Background())

log.Info().Msgf("discover related assets for %d asset(s)", len(conf.Inventory.Spec.Assets))
im, err := inventory.New(inventory.WithInventory(conf.Inventory), inventory.WithCachedCredsResolver())
im, err := inventory.New(inventory.WithInventory(conf.Inventory))
if err != nil {
log.Fatal().Err(err).Msg("could not load asset information")
}
Expand Down Expand Up @@ -268,7 +268,7 @@ configure your Azure credentials and have SSH access to your virtual machines.`,
log.Fatal().Msg("no asset selected")
}

backend, err := provider_resolver.OpenAssetConnection(ctx, connectAsset, im.CredsResolver, false)
backend, err := provider_resolver.OpenAssetConnection(ctx, connectAsset, im.GetCredsResolver(), false)
if err != nil {
log.Fatal().Err(err).Msg("could not connect to asset")
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
github.com/spf13/pflag v1.0.6-0.20201009195203-85dd5c8bc61c
github.com/spf13/viper v1.14.0
github.com/stretchr/testify v1.8.1
go.mondoo.com/cnquery v0.0.0-20230207172725-ba4483495033
go.mondoo.com/cnquery v0.0.0-20230207200324-77516fdb2544
go.mondoo.com/ranger-rpc v0.5.1-0.20220923135836-9e7732899d34
go.opentelemetry.io/otel v1.11.1
golang.org/x/sync v0.1.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1389,6 +1389,8 @@ gitlab.com/bosi/decorder v0.2.3 h1:gX4/RgK16ijY8V+BRQHAySfQAb354T7/xQpDB2n10P0=
gitlab.com/bosi/decorder v0.2.3/go.mod h1:9K1RB5+VPNQYtXtTDAzd2OEftsZb1oV0IrJrzChSdGE=
go.mondoo.com/cnquery v0.0.0-20230207172725-ba4483495033 h1:dMZm4MH7H9A0i4KtCOmayo9lWH7dTLbH5O5w7D3ZQ6s=
go.mondoo.com/cnquery v0.0.0-20230207172725-ba4483495033/go.mod h1:LvGUOSPIQ31zXDkK/Ig8oMgqmQU8zbKuJZyaqmQHRSE=
go.mondoo.com/cnquery v0.0.0-20230207200324-77516fdb2544 h1:lYuhLJF+S5hMEsKYoTEeG9NnsxOTzByzj9lyjLXDCpw=
go.mondoo.com/cnquery v0.0.0-20230207200324-77516fdb2544/go.mod h1:LvGUOSPIQ31zXDkK/Ig8oMgqmQU8zbKuJZyaqmQHRSE=
go.mondoo.com/ranger-rpc v0.5.1-0.20220923135836-9e7732899d34 h1:mtPZ1J+nRI/ivV+n41bjIwY6Rfxb2Jf49svZSQMGHIA=
go.mondoo.com/ranger-rpc v0.5.1-0.20220923135836-9e7732899d34/go.mod h1:3YKcqFrlPgaB4FZ4EoLgdmRtwMQdO7RoAkZYFn+F1eY=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
Expand Down
4 changes: 2 additions & 2 deletions policy/scan/local_scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func (s *LocalScanner) RunIncognito(ctx context.Context, job *Job) (*ScanResult,

func (s *LocalScanner) distributeJob(job *Job, ctx context.Context, upstreamConfig resources.UpstreamConfig) (*ScanResult, bool, error) {
log.Info().Msgf("discover related assets for %d asset(s)", len(job.Inventory.Spec.Assets))
im, err := inventory.New(inventory.WithInventory(job.Inventory), inventory.WithCachedCredsResolver())
im, err := inventory.New(inventory.WithInventory(job.Inventory))
if err != nil {
return nil, false, errors.Wrap(err, "could not load asset information")
}
Expand Down Expand Up @@ -267,7 +267,7 @@ func (s *LocalScanner) distributeJob(job *Job, ctx context.Context, upstreamConf
Bundle: job.Bundle,
PolicyFilters: job.PolicyFilters,
Ctx: ctx,
CredsResolver: im.CredsResolver,
CredsResolver: im.GetCredsResolver(),
Reporter: reporter,
ProgressReporter: p,
})
Expand Down

0 comments on commit 8859c4d

Please sign in to comment.