Skip to content

Commit

Permalink
Try to reconnect broken providers before scan
Browse files Browse the repository at this point in the history
  • Loading branch information
jaym committed Sep 9, 2024
1 parent 4be18f5 commit d44ed56
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ require (
github.com/spf13/pflag v1.0.6-0.20201009195203-85dd5c8bc61c
github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.9.0
go.mondoo.com/cnquery/v11 v11.20.1
go.mondoo.com/cnquery/v11 v11.20.2-0.20240909113554-342ea94d4bdd
go.mondoo.com/mondoo-go v0.0.0-20240819110653-687d75eb1183
go.mondoo.com/ranger-rpc v0.6.3
go.opentelemetry.io/otel v1.29.0
Expand Down Expand Up @@ -269,7 +269,7 @@ require (
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 // indirect
golang.org/x/mod v0.20.0 // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/oauth2 v0.22.0 // indirect
golang.org/x/sync v0.8.0 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,8 @@ go.etcd.io/etcd/client/pkg/v3 v3.5.1/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3
go.etcd.io/etcd/client/v2 v2.305.1/go.mod h1:pMEacxZW7o8pg4CrFE7pquyCJJzZvkvdD2RibOCCCGs=
go.mondoo.com/cnquery/v11 v11.20.1 h1:fwsJkDNUCkwtoq5Gr3o7E/r7bYeFwcG1DjRf2EOk+TU=
go.mondoo.com/cnquery/v11 v11.20.1/go.mod h1:QIeINM/20bGQo5e3oyBFRzjccRRZhH8DtLlSNVfpYIg=
go.mondoo.com/cnquery/v11 v11.20.2-0.20240909113554-342ea94d4bdd h1:GLx/hcO9NI4kq5rq7sVFXZjOKIOGJvcN81VidAgpD5M=
go.mondoo.com/cnquery/v11 v11.20.2-0.20240909113554-342ea94d4bdd/go.mod h1:QIeINM/20bGQo5e3oyBFRzjccRRZhH8DtLlSNVfpYIg=
go.mondoo.com/mondoo-go v0.0.0-20240819110653-687d75eb1183 h1:IpUOrXDa31euZKYfbBEkyZTTUGK3CtF2l8Wy1T0YG/o=
go.mondoo.com/mondoo-go v0.0.0-20240819110653-687d75eb1183/go.mod h1:lF3LCT7QHJekrCjQjYkectEQ/atQ0UELtsuBuXHNRxo=
go.mondoo.com/ranger-rpc v0.6.3 h1:XpJatFv0m6FxiVwgwKVlDkO6EcjGf6TnoJSlNh3d7Ks=
Expand Down Expand Up @@ -1051,6 +1053,8 @@ golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0=
golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down
4 changes: 4 additions & 0 deletions policy/scan/local_scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,10 @@ func (s *LocalScanner) distributeJob(job *Job, ctx context.Context, upstream *up
asset := batch[i].Asset
runtime := batch[i].Runtime

if err := runtime.EnsureProvidersConnected(); err != nil {
log.Error().Err(err).Msg("could not connect to providers")
}

log.Debug().Interface("platform", asset.Platform).Str("name", asset.Name).Msg("start scan")

// Make sure the context has not been canceled in the meantime. Note that this approach works only for single threaded execution. If we have more than 1 thread calling this function,
Expand Down

0 comments on commit d44ed56

Please sign in to comment.