Skip to content

Commit

Permalink
Add StandardGatherers utility to retrieve all the wired up gatherers
Browse files Browse the repository at this point in the history
  • Loading branch information
CDimonaco committed Sep 27, 2022
1 parent 22e9059 commit 1b71c7e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 2 additions & 6 deletions cmd/facts.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ func gather(*cobra.Command, []string) {
var argument = viper.GetString("argument")
var pluginsFolder = viper.GetString("plugins-folder")

gathererManager := gatherers.NewManager(map[string]gatherers.FactGatherer{
gatherers.CorosyncFactKey: gatherers.NewDefaultCorosyncConfGatherer(),
})
gathererManager := gatherers.NewManager(gatherers.StandardGatherers())

log.Info("loading plugins")

Expand Down Expand Up @@ -137,9 +135,7 @@ func cleanupAndFatal(err error) {
func list(*cobra.Command, []string) {
var pluginsFolder = viper.GetString("plugins-folder")

gathererManager := gatherers.NewManager(map[string]gatherers.FactGatherer{
gatherers.CorosyncFactKey: gatherers.NewDefaultCorosyncConfGatherer(),
})
gathererManager := gatherers.NewManager(gatherers.StandardGatherers())

log.Info("loading plugins")

Expand Down
4 changes: 1 addition & 3 deletions internal/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,7 @@ func (a *Agent) Start(ctx context.Context) error {

if a.config.FactsEngineEnabled {

gathererManager := gatherers.NewManager(map[string]gatherers.FactGatherer{
gatherers.CorosyncFactKey: gatherers.NewDefaultCorosyncConfGatherer(),
})
gathererManager := gatherers.NewManager(gatherers.StandardGatherers())

log.Info("loading plugins")

Expand Down
6 changes: 6 additions & 0 deletions internal/factsengine/gatherers/gatherer.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ import "github.com/trento-project/agent/internal/factsengine/entities"
type FactGatherer interface {
Gather(factsRequests []entities.FactRequest) ([]entities.Fact, error)
}

func StandardGatherers() map[string]FactGatherer {
return map[string]FactGatherer{
CorosyncFactKey: NewDefaultCorosyncConfGatherer(),
}
}

0 comments on commit 1b71c7e

Please sign in to comment.