Skip to content

Commit

Permalink
🐛 return v9 portion in provider IDs
Browse files Browse the repository at this point in the history
We have a bug in cnquery/cnspec v9 where differences in the ID can cause
a crash:

```
 panic: shell flag redefined: sudo

goroutine 1 [running]:
github.com/spf13/pflag.(*FlagSet).AddFlag(0xc000516200, 0xc000debb80)
    /home/runner/go/pkg/mod/github.com/spf13/pflag@v1.0.6-0.20201009195203-85dd5c8bc61c/flag.go:855 +0x5ec
github.com/spf13/pflag.(*FlagSet).VarPF(0x10?, {0x22dbdc8, 0xc000afe960}, {0xc0006e72c8, 0x4}, {0x0, 0x0}, {0xc00005b2c0, 0x1d})
    /home/runner/go/pkg/mod/github.com/spf13/pflag@v1.0.6-0.20201009195203-85dd5c8bc61c/flag.go:838 +0x14f
github.com/spf13/pflag.(*FlagSet).BoolVarP(0xc000afe938?, 0x5?, {0xc0006e72c8?, 0x1946360?}, {0x0?, 0x1dbe006?}, 0x33?, {0xc00005b2c0?, 0x3167bc0?})
    /home/runner/go/pkg/mod/github.com/spf13/pflag@v1.0.6-0.20201009195203-85dd5c8bc61c/bool.go:55 +0x3e
github.com/spf13/pflag.(*FlagSet).BoolP(...)
    /home/runner/go/pkg/mod/github.com/spf13/pflag@v1.0.6-0.20201009195203-85dd5c8bc61c/bool.go:80
github.com/spf13/pflag.(*FlagSet).Bool(...)
    /home/runner/go/pkg/mod/github.com/spf13/pflag@v1.0.6-0.20201009195203-85dd5c8bc61c/bool.go:74
go.mondoo.com/cnquery/v9/cli/providers.attachFlag(0x0?, {{0xc0006e72c8, 0x4}, {0x0, 0x0}, {0xc0006e72d0, 0x5}, {0xc00005b2c0, 0x1d}, 0x1, ...})
```

This happens when e.g.:

```
→ /home/zero/.config/mondoo/providers (found 1 providers)

  os 10.0.0 with connectors: local, ssh, winrm, vagrant, container, docker, filesystem

→ /opt/mondoo/providers (found 1 providers)

  os 9.1.17 with connectors: local, ssh, winrm, vagrant, container, docker, filesystem
```

i.e. when we have an old-style provider ID (in v9.1.17) and a new-style
provider ID (which we tried to introduce with this version).

As soon as the ID is restored to be the same, this continue to work with
cnquery/cnspec v9.x. We will keep the old version tag in each provider
for the duration of v9.x support and remove the version indication from
the ID once it is sunset (i.e. when we release v11.0).

This may only be an edge-case with an easy solution/workaround, but it
is an annoying experience. We will suffer with a confusing ID for a
little bit until we can comfortably clean it up.

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
  • Loading branch information
arlimus committed Jan 18, 2024
1 parent 0501c83 commit 2d6c483
Show file tree
Hide file tree
Showing 21 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion providers/arista/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

var Config = plugin.Provider{
Name: "arista",
ID: "go.mondoo.com/cnquery/providers/arista",
ID: "go.mondoo.com/cnquery/v9/providers/arista",
Version: "9.1.15",
ConnectionTypes: []string{provider.ConnectionType},
Connectors: []plugin.Connector{
Expand Down
2 changes: 1 addition & 1 deletion providers/atlassian/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

var Config = plugin.Provider{
Name: "atlassian",
ID: "go.mondoo.com/cnquery/providers/atlassian",
ID: "go.mondoo.com/cnquery/v9/providers/atlassian",
Version: "9.1.15",
ConnectionTypes: []string{
provider.DefaultConnectionType,
Expand Down
2 changes: 1 addition & 1 deletion providers/aws/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

var Config = plugin.Provider{
Name: "aws",
ID: "go.mondoo.com/cnquery/providers/aws",
ID: "go.mondoo.com/cnquery/v9/providers/aws",
Version: "9.1.25",
ConnectionTypes: []string{provider.DefaultConnectionType, string(awsec2ebsconn.EBSConnectionType)},
Connectors: []plugin.Connector{
Expand Down
2 changes: 1 addition & 1 deletion providers/azure/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

var Config = plugin.Provider{
Name: "azure",
ID: "go.mondoo.com/cnquery/providers/azure",
ID: "go.mondoo.com/cnquery/v9/providers/azure",
Version: "9.2.1",
ConnectionTypes: []string{
provider.ConnectionType,
Expand Down
2 changes: 1 addition & 1 deletion providers/equinix/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

var Config = plugin.Provider{
Name: "equinix",
ID: "go.mondoo.com/cnquery/providers/equinix",
ID: "go.mondoo.com/cnquery/v9/providers/equinix",
Version: "9.1.16",
ConnectionTypes: []string{provider.ConnectionType},
Connectors: []plugin.Connector{
Expand Down
2 changes: 1 addition & 1 deletion providers/gcp/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

var Config = plugin.Provider{
Name: "gcp",
ID: "go.mondoo.com/cnquery/providers/gcp",
ID: "go.mondoo.com/cnquery/v9/providers/gcp",
Version: "9.1.18",
ConnectionTypes: []string{
provider.ConnectionType,
Expand Down
2 changes: 1 addition & 1 deletion providers/github/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

var Config = plugin.Provider{
Name: "github",
ID: "go.mondoo.com/cnquery/providers/github",
ID: "go.mondoo.com/cnquery/v9/providers/github",
Version: "9.1.19",
ConnectionTypes: []string{provider.ConnectionType},
Connectors: []plugin.Connector{
Expand Down
2 changes: 1 addition & 1 deletion providers/gitlab/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

var Config = plugin.Provider{
Name: "gitlab",
ID: "go.mondoo.com/cnquery/providers/gitlab",
ID: "go.mondoo.com/cnquery/v9/providers/gitlab",
Version: "9.1.16",
ConnectionTypes: []string{
provider.ConnectionType,
Expand Down
2 changes: 1 addition & 1 deletion providers/google-workspace/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

var Config = plugin.Provider{
Name: "google-workspace",
ID: "go.mondoo.com/cnquery/providers/google-workspace",
ID: "go.mondoo.com/cnquery/v9/providers/google-workspace",
Version: "9.1.19",
ConnectionTypes: []string{provider.ConnectionType},
Connectors: []plugin.Connector{
Expand Down
2 changes: 1 addition & 1 deletion providers/ipmi/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

var Config = plugin.Provider{
Name: "ipmi",
ID: "go.mondoo.com/cnquery/providers/ipmi",
ID: "go.mondoo.com/cnquery/v9/providers/ipmi",
Version: "9.1.16",
ConnectionTypes: []string{provider.ConnectionType},
Connectors: []plugin.Connector{
Expand Down
2 changes: 1 addition & 1 deletion providers/k8s/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

var Config = plugin.Provider{
Name: "k8s",
ID: "go.mondoo.com/cnquery/providers/k8s",
ID: "go.mondoo.com/cnquery/v9/providers/k8s",
Version: "9.1.22",
ConnectionTypes: []string{provider.ConnectionType},
Connectors: []plugin.Connector{
Expand Down
2 changes: 1 addition & 1 deletion providers/ms365/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

var Config = plugin.Provider{
Name: "ms365",
ID: "go.mondoo.com/cnquery/providers/ms365",
ID: "go.mondoo.com/cnquery/v9/providers/ms365",
Version: "9.2.14",
ConnectionTypes: []string{provider.ConnectionType},
Connectors: []plugin.Connector{
Expand Down
2 changes: 1 addition & 1 deletion providers/network/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

var Config = plugin.Provider{
Name: "network",
ID: "go.mondoo.com/cnquery/providers/network",
ID: "go.mondoo.com/cnquery/v9/providers/network",
Version: "9.1.8",
ConnectionTypes: []string{provider.HostConnectionType},
CrossProviderTypes: []string{
Expand Down
2 changes: 1 addition & 1 deletion providers/oci/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

var Config = plugin.Provider{
Name: "oci",
ID: "go.mondoo.com/cnquery/providers/oci",
ID: "go.mondoo.com/cnquery/v9/providers/oci",
Version: "9.1.17",
ConnectionTypes: []string{provider.ConnectionType},
Connectors: []plugin.Connector{
Expand Down
2 changes: 1 addition & 1 deletion providers/okta/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

var Config = plugin.Provider{
Name: "okta",
ID: "go.mondoo.com/cnquery/providers/okta",
ID: "go.mondoo.com/cnquery/v9/providers/okta",
Version: "9.1.16",
ConnectionTypes: []string{provider.ConnectionType},
Connectors: []plugin.Connector{
Expand Down
2 changes: 1 addition & 1 deletion providers/opcua/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

var Config = plugin.Provider{
Name: "opcua",
ID: "go.mondoo.com/cnquery/providers/opcua",
ID: "go.mondoo.com/cnquery/v9/providers/opcua",
Version: "9.1.15",
ConnectionTypes: []string{provider.ConnectionType},
Connectors: []plugin.Connector{
Expand Down
2 changes: 1 addition & 1 deletion providers/os/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

var Config = plugin.Provider{
Name: "os",
ID: "go.mondoo.com/cnquery/providers/os",
ID: "go.mondoo.com/cnquery/v9/providers/os",
Version: "9.1.20",
ConnectionTypes: []string{
provider.LocalConnectionType,
Expand Down
2 changes: 1 addition & 1 deletion providers/slack/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

var Config = plugin.Provider{
Name: "slack",
ID: "go.mondoo.com/cnquery/providers/slack",
ID: "go.mondoo.com/cnquery/v9/providers/slack",
Version: "9.1.17",
ConnectionTypes: []string{provider.ConnectionType},
Connectors: []plugin.Connector{
Expand Down
2 changes: 1 addition & 1 deletion providers/terraform/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

var Config = plugin.Provider{
Name: "terraform",
ID: "go.mondoo.com/cnquery/providers/terraform",
ID: "go.mondoo.com/cnquery/v9/providers/terraform",
Version: "9.1.15",
ConnectionTypes: []string{
provider.StateConnectionType,
Expand Down
2 changes: 1 addition & 1 deletion providers/vcd/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

var Config = plugin.Provider{
Name: "vcd",
ID: "go.mondoo.com/cnquery/providers/vcd",
ID: "go.mondoo.com/cnquery/v9/providers/vcd",
Version: "9.1.15",
ConnectionTypes: []string{provider.ConnectionType},
Connectors: []plugin.Connector{
Expand Down
2 changes: 1 addition & 1 deletion providers/vsphere/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

var Config = plugin.Provider{
Name: "vsphere",
ID: "go.mondoo.com/cnquery/providers/vsphere",
ID: "go.mondoo.com/cnquery/v9/providers/vsphere",
Version: "9.1.18",
ConnectionTypes: []string{provider.ConnectionType},
Connectors: []plugin.Connector{
Expand Down

0 comments on commit 2d6c483

Please sign in to comment.