Skip to content

Commit

Permalink
Do not add connections in error to plugin manager connection map. Closes
Browse files Browse the repository at this point in the history
  • Loading branch information
kaidaguerre authored Sep 22, 2023
1 parent 93afa55 commit 6f051ea
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions cmd/plugin_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ func createPluginManager(cmd *cobra.Command) (*pluginmanager_service.PluginManag
}
}()

// create a map of connections configs, excluding connections in error
configMap := connection.NewConnectionConfigMap(steampipeConfig.Connections)
log.Printf("[TRACE] loaded config map: %s", strings.Join(steampipeConfig.ConnectionNames(), ","))

Expand Down
6 changes: 6 additions & 0 deletions pkg/connection/config_map.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@ import (

type ConnectionConfigMap map[string]*sdkproto.ConnectionConfig

// NewConnectionConfigMap creates a map of sdkproto.ConnectionConfig keyed by connection name
// NOTE: connections in error are EXCLUDED
func NewConnectionConfigMap(connectionMap map[string]*modconfig.Connection) ConnectionConfigMap {
configMap := make(ConnectionConfigMap)
for k, v := range connectionMap {
if v.Error != nil {
continue
}

configMap[k] = &sdkproto.ConnectionConfig{
Connection: v.Name,
Plugin: v.Plugin,
Expand Down
2 changes: 1 addition & 1 deletion pkg/pluginmanager_service/plugin_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ func (m *PluginManager) addRunningPlugin(pluginInstance string) (*runningPlugin,
pluginConfig := m.plugins[pluginInstance]
if pluginConfig == nil {
// not expected
return nil, sperr.New("plugin manager has no config for plkugin instance %s", pluginInstance)
return nil, sperr.New("plugin manager has no config for plugin instance %s", pluginInstance)
}
// create the running plugin
startingPlugin := &runningPlugin{
Expand Down
2 changes: 1 addition & 1 deletion pkg/pluginmanager_service/plugin_manager_rate_limiters.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func (m *PluginManager) initialiseRateLimiterDefs(ctx context.Context) (e error)
if err != nil {
return err
}
// TODO KAI TACTICAL to force recreation
// TODO KAI TACTICAL to force recreation - remove in beta.2
rateLimiterTableExists = false

if !rateLimiterTableExists {
Expand Down

0 comments on commit 6f051ea

Please sign in to comment.