Skip to content

Commit

Permalink
🐛 provider shutdown for login and logout (#2375)
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Milchev <ivan@mondoo.com>
  • Loading branch information
imilchev authored Oct 26, 2023
1 parent 108b50f commit 734f13e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions apps/cnquery/cmd/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"go.mondoo.com/cnquery/v9"
"go.mondoo.com/cnquery/v9/cli/config"
"go.mondoo.com/cnquery/v9/cli/sysinfo"
cnquery_providers "go.mondoo.com/cnquery/v9/providers"
"go.mondoo.com/cnquery/v9/providers-sdk/v1/upstream"
"go.mondoo.com/ranger-rpc"
"go.mondoo.com/ranger-rpc/plugins/authentication/statictoken"
Expand Down Expand Up @@ -47,6 +48,7 @@ You remain logged in until you explicitly log out using the 'logout' subcommand.
viper.BindPFlag("name", cmd.Flags().Lookup("name"))
},
Run: func(cmd *cobra.Command, args []string) {
defer cnquery_providers.Coordinator.Shutdown()
token, _ := cmd.Flags().GetString("token")
annotations, _ := cmd.Flags().GetStringToString("annotation")
register(token, annotations)
Expand Down
2 changes: 2 additions & 0 deletions apps/cnquery/cmd/logout.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/spf13/viper"
"go.mondoo.com/cnquery/v9/cli/config"
"go.mondoo.com/cnquery/v9/cli/sysinfo"
cnquery_providers "go.mondoo.com/cnquery/v9/providers"
"go.mondoo.com/cnquery/v9/providers-sdk/v1/upstream"
"sigs.k8s.io/yaml"
)
Expand All @@ -33,6 +34,7 @@ ensure the credentials cannot be used in the future.
viper.BindPFlag("force", cmd.Flags().Lookup("force"))
},
Run: func(cmd *cobra.Command, args []string) {
defer cnquery_providers.Coordinator.Shutdown()
var err error

// its perfectly fine not to have a config here, therefore we ignore errors
Expand Down

0 comments on commit 734f13e

Please sign in to comment.