diff --git a/providers-sdk/v1/inventory/inventory.go b/providers-sdk/v1/inventory/inventory.go index 76157d12a0..6d5323d56e 100644 --- a/providers-sdk/v1/inventory/inventory.go +++ b/providers-sdk/v1/inventory/inventory.go @@ -9,6 +9,7 @@ import ( "strings" "github.com/cockroachdb/errors" + "github.com/rs/zerolog/log" "github.com/segmentio/ksuid" "go.mondoo.com/cnquery/providers-sdk/v1/vault" "google.golang.org/protobuf/proto" @@ -56,7 +57,8 @@ func InventoryFromYAML(data []byte) (*Inventory, error) { for _, asset := range res.Spec.Assets { for _, conn := range asset.Connections { if conn.Type == "" { - conn.Type = connBackendToType(conn.Backend) + log.Warn().Msg("no connection type provided, falling back to deprecated option backend") + conn.Type = ConnBackendToType(conn.Backend) } } } diff --git a/providers-sdk/v1/inventory/v8_inventory.go b/providers-sdk/v1/inventory/v8_inventory.go index 7f31fc6393..6abd2eb7ac 100644 --- a/providers-sdk/v1/inventory/v8_inventory.go +++ b/providers-sdk/v1/inventory/v8_inventory.go @@ -114,7 +114,7 @@ func (s *ProviderType) UnmarshalJSON(data []byte) error { return nil } -func connBackendToType(backend ProviderType) string { +func ConnBackendToType(backend ProviderType) string { switch backend { case ProviderType_LOCAL_OS: return "os" diff --git a/providers/runtime.go b/providers/runtime.go index 90df00ee98..10e8722d3d 100644 --- a/providers/runtime.go +++ b/providers/runtime.go @@ -160,11 +160,8 @@ func (r *Runtime) DetectProvider(asset *inventory.Asset) error { for i := range asset.Connections { conn := asset.Connections[i] if conn.Type == "" { - if conn.Backend != "" { - conn.Type = conn.Backend - } else { - continue - } + log.Warn().Msg("no connection type provided, falling back to deprecated option backend") + conn.Type = inventory.ConnBackendToType(conn.Backend) } provider, err := EnsureProvider("", conn.Type, true, r.coordinator.Providers)