diff --git a/explorer/scan/local_scanner.go b/explorer/scan/local_scanner.go index 87b979f577..942548abe9 100644 --- a/explorer/scan/local_scanner.go +++ b/explorer/scan/local_scanner.go @@ -188,15 +188,11 @@ func (s *LocalScanner) distributeJob(job *Job, ctx context.Context, upstream *up log.Error().Err(err).Msg("unable to connect to asset") continue } - inventorySpec := runtime.Provider.Connection - if inventorySpec.Inventory != nil && - inventorySpec.Inventory.Spec != nil && - inventorySpec.Inventory.Spec.Assets != nil { - log.Debug().Msgf("adding %d discovered asset(s)", len(runtime.Provider.Connection.Inventory.Spec.Assets)) - assetCandidates = append(assetCandidates, inventorySpec.Inventory.Spec.Assets...) - } else { - assetCandidates = append(assetCandidates, runtime.Provider.Connection.Asset) + processedAssets, err := providers.ProcessAssetCandidates(runtime, runtime.Provider.Connection, upstream, "") + if err != nil { + return nil, false, err } + assetCandidates = append(assetCandidates, processedAssets...) // TODO: we want to keep better track of errors, since there may be // multiple assets coming in. It's annoying to abort the scan if we get one // error at this stage. diff --git a/providers/aws/provider/provider.go b/providers/aws/provider/provider.go index f900f26ff3..af3a938c24 100644 --- a/providers/aws/provider/provider.go +++ b/providers/aws/provider/provider.go @@ -13,16 +13,12 @@ import ( "go.mondoo.com/cnquery/providers-sdk/v1/upstream" "go.mondoo.com/cnquery/providers/aws/connection" "go.mondoo.com/cnquery/providers/aws/resources" - osconnection "go.mondoo.com/cnquery/providers/os/connection" "go.mondoo.com/cnquery/providers/os/connection/shared" - "go.mondoo.com/cnquery/providers/os/detector" ) const ( - defaultConnection uint32 = 1 - DefaultConnectionType = "aws" - SshConnectionType = "ssh" - RegistryImageConnectionType = "registry-image" + defaultConnection uint32 = 1 + DefaultConnectionType = "aws" ) type Service struct { @@ -134,20 +130,9 @@ func (s *Service) connect(req *plugin.ConnectReq, callback plugin.ProviderCallba var err error switch conf.Type { - case SshConnectionType: - s.lastConnectionID++ - conn, err = osconnection.NewSshConnection(s.lastConnectionID, conf, asset) - if pf, ok := detector.DetectOS(conn); ok { - conn.Asset().Platform = pf - } - - case RegistryImageConnectionType: - s.lastConnectionID++ - conn, err = osconnection.NewContainerRegistryImage(s.lastConnectionID, conf, asset) default: s.lastConnectionID++ conn, err = connection.NewAwsConnection(s.lastConnectionID, asset, conf) - } if err != nil { return nil, err