diff --git a/cmd/crowdsec-cli/capi.go b/cmd/crowdsec-cli/capi.go index 3319ca0c8..78b4ee0c9 100644 --- a/cmd/crowdsec-cli/capi.go +++ b/cmd/crowdsec-cli/capi.go @@ -137,7 +137,7 @@ func NewCapiCmd() *cobra.Command { log.Fatalf("Failed to load hub index : %s", err) log.Infoln("Run 'sudo cscli hub update' to get the hub index") } - scenarios, err := cwhub.GetUpstreamInstalledScenariosAsString() + scenarios, err := cwhub.GetInstalledScenariosAsString() if err != nil { log.Fatalf("failed to get scenarios : %s", err.Error()) } diff --git a/cmd/crowdsec-cli/console.go b/cmd/crowdsec-cli/console.go index 67219c84e..342fbd68b 100644 --- a/cmd/crowdsec-cli/console.go +++ b/cmd/crowdsec-cli/console.go @@ -85,7 +85,7 @@ After running this command your will need to validate the enrollment in the weba log.Infoln("Run 'sudo cscli hub update' to get the hub index") } - scenarios, err := cwhub.GetUpstreamInstalledScenariosAsString() + scenarios, err := cwhub.GetInstalledScenariosAsString() if err != nil { log.Fatalf("failed to get scenarios : %s", err.Error()) } diff --git a/cmd/crowdsec-cli/lapi.go b/cmd/crowdsec-cli/lapi.go index 3bb271dd5..88e4bb004 100644 --- a/cmd/crowdsec-cli/lapi.go +++ b/cmd/crowdsec-cli/lapi.go @@ -146,7 +146,7 @@ Keep in mind the machine needs to be validated by an administrator on LAPI side log.Fatalf("Failed to load hub index : %s", err) log.Infoln("Run 'sudo cscli hub update' to get the hub index") } - scenarios, err := cwhub.GetUpstreamInstalledScenariosAsString() + scenarios, err := cwhub.GetInstalledScenariosAsString() if err != nil { log.Fatalf("failed to get scenarios : %s", err.Error()) } diff --git a/cmd/crowdsec/output.go b/cmd/crowdsec/output.go index 713fd6d56..bb7ab1ea1 100644 --- a/cmd/crowdsec/output.go +++ b/cmd/crowdsec/output.go @@ -69,7 +69,7 @@ func runOutput(input chan types.Event, overflow chan types.Event, buckets *leaky var cache []types.RuntimeAlert var cacheMutex sync.Mutex - scenarios, err := cwhub.GetUpstreamInstalledScenariosAsString() + scenarios, err := cwhub.GetInstalledScenariosAsString() if err != nil { return errors.Wrapf(err, "loading list of installed hub scenarios: %s", err) } @@ -88,7 +88,7 @@ func runOutput(input chan types.Event, overflow chan types.Event, buckets *leaky UserAgent: fmt.Sprintf("crowdsec/%s", cwversion.VersionStr()), URL: apiURL, VersionPrefix: "v1", - UpdateScenario: cwhub.GetUpstreamInstalledScenariosAsString, + UpdateScenario: cwhub.GetInstalledScenariosAsString, }) if err != nil { return errors.Wrapf(err, "new client api: %s", err) diff --git a/pkg/cwhub/cwhub.go b/pkg/cwhub/cwhub.go index 1cdf3e276..cda651c3e 100644 --- a/pkg/cwhub/cwhub.go +++ b/pkg/cwhub/cwhub.go @@ -236,10 +236,10 @@ func ItemStatus(v Item) (string, bool, bool, bool) { return strret, Ok, Warning, Managed } -func GetUpstreamInstalledScenariosAsString() ([]string, error) { +func GetInstalledScenariosAsString() ([]string, error) { var retStr []string - items, err := GetUpstreamInstalledScenarios() + items, err := GetInstalledScenarios() if err != nil { return nil, errors.Wrap(err, "while fetching scenarios") } @@ -249,14 +249,14 @@ func GetUpstreamInstalledScenariosAsString() ([]string, error) { return retStr, nil } -func GetUpstreamInstalledScenarios() ([]Item, error) { +func GetInstalledScenarios() ([]Item, error) { var retItems []Item if _, ok := hubIdx[SCENARIOS]; !ok { return nil, fmt.Errorf("no scenarios in hubIdx") } for _, item := range hubIdx[SCENARIOS] { - if item.Installed && !item.Tainted { + if item.Installed { retItems = append(retItems, item) } }