From b6b6fd026b2a8dce6256acb4402a6ee106562497 Mon Sep 17 00:00:00 2001 From: mmetc <92726601+mmetc@users.noreply.github.com> Date: Fri, 21 Jul 2023 23:23:24 +0200 Subject: [PATCH] typo fix, uppercase 'API', adjusted log level (#2361) --- cmd/crowdsec-cli/bouncers.go | 2 +- cmd/crowdsec-cli/dashboard.go | 4 ++-- cmd/crowdsec-cli/lapi.go | 2 +- cmd/crowdsec-cli/main.go | 14 +++++++------- cmd/crowdsec-cli/metrics_table.go | 12 ++++++------ pkg/csprofiles/csprofiles.go | 2 +- pkg/leakybucket/manager_load.go | 2 +- test/bats/01_cscli.bats | 2 +- test/bats/04_nocapi.bats | 2 +- test/bats/10_bouncers.bats | 2 +- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/cmd/crowdsec-cli/bouncers.go b/cmd/crowdsec-cli/bouncers.go index 839cf84eb..96fc8c5a2 100644 --- a/cmd/crowdsec-cli/bouncers.go +++ b/cmd/crowdsec-cli/bouncers.go @@ -107,7 +107,7 @@ func runBouncersAdd(cmd *cobra.Command, args []string) error { } if csConfig.Cscli.Output == "human" { - fmt.Printf("Api key for '%s':\n\n", keyName) + fmt.Printf("API key for '%s':\n\n", keyName) fmt.Printf(" %s\n\n", apiKey) fmt.Print("Please keep this key since you will not be able to retrieve it!\n") } else if csConfig.Cscli.Output == "raw" { diff --git a/cmd/crowdsec-cli/dashboard.go b/cmd/crowdsec-cli/dashboard.go index 28448c6c8..c6069c71c 100644 --- a/cmd/crowdsec-cli/dashboard.go +++ b/cmd/crowdsec-cli/dashboard.go @@ -196,8 +196,8 @@ cscli dashboard setup -l 0.0.0.0 -p 443 --password fmt.Printf("\tpassword : '%s'\n", mb.Config.Password) }, } - cmdDashSetup.Flags().BoolVarP(&force, "force", "f", false, "Force setup : override existing files.") - cmdDashSetup.Flags().StringVarP(&metabaseDbPath, "dir", "d", "", "Shared directory with metabase container.") + cmdDashSetup.Flags().BoolVarP(&force, "force", "f", false, "Force setup : override existing files") + cmdDashSetup.Flags().StringVarP(&metabaseDbPath, "dir", "d", "", "Shared directory with metabase container") cmdDashSetup.Flags().StringVarP(&metabaseListenAddress, "listen", "l", metabaseListenAddress, "Listen address of container") cmdDashSetup.Flags().StringVarP(&metabaseListenPort, "port", "p", metabaseListenPort, "Listen port of container") cmdDashSetup.Flags().BoolVarP(&forceYes, "yes", "y", false, "force yes") diff --git a/cmd/crowdsec-cli/lapi.go b/cmd/crowdsec-cli/lapi.go index d03662c48..e4353ac19 100644 --- a/cmd/crowdsec-cli/lapi.go +++ b/cmd/crowdsec-cli/lapi.go @@ -180,7 +180,7 @@ func NewLapiRegisterCmd() *cobra.Command { cmdLapiRegister := &cobra.Command{ Use: "register", Short: "Register a machine to Local API (LAPI)", - Long: `Register you machine to the Local API (LAPI). + Long: `Register your machine to the Local API (LAPI). Keep in mind the machine needs to be validated by an administrator on LAPI side to be effective.`, Args: cobra.MinimumNArgs(0), DisableAutoGenTag: true, diff --git a/cmd/crowdsec-cli/main.go b/cmd/crowdsec-cli/main.go index beab47913..7a7814e63 100644 --- a/cmd/crowdsec-cli/main.go +++ b/cmd/crowdsec-cli/main.go @@ -199,13 +199,13 @@ It is meant to allow you to manage bans, parsers/scenarios/etc, api and generall rootCmd.AddCommand(cmdVersion) rootCmd.PersistentFlags().StringVarP(&ConfigFilePath, "config", "c", csconfig.DefaultConfigPath("config.yaml"), "path to crowdsec config file") - rootCmd.PersistentFlags().StringVarP(&OutputFormat, "output", "o", "", "Output format: human, json, raw.") - rootCmd.PersistentFlags().StringVarP(&OutputColor, "color", "", "auto", "Output color: yes, no, auto.") - rootCmd.PersistentFlags().BoolVar(&dbg_lvl, "debug", false, "Set logging to debug.") - rootCmd.PersistentFlags().BoolVar(&nfo_lvl, "info", false, "Set logging to info.") - rootCmd.PersistentFlags().BoolVar(&wrn_lvl, "warning", false, "Set logging to warning.") - rootCmd.PersistentFlags().BoolVar(&err_lvl, "error", false, "Set logging to error.") - rootCmd.PersistentFlags().BoolVar(&trace_lvl, "trace", false, "Set logging to trace.") + rootCmd.PersistentFlags().StringVarP(&OutputFormat, "output", "o", "", "Output format: human, json, raw") + rootCmd.PersistentFlags().StringVarP(&OutputColor, "color", "", "auto", "Output color: yes, no, auto") + rootCmd.PersistentFlags().BoolVar(&dbg_lvl, "debug", false, "Set logging to debug") + rootCmd.PersistentFlags().BoolVar(&nfo_lvl, "info", false, "Set logging to info") + rootCmd.PersistentFlags().BoolVar(&wrn_lvl, "warning", false, "Set logging to warning") + rootCmd.PersistentFlags().BoolVar(&err_lvl, "error", false, "Set logging to error") + rootCmd.PersistentFlags().BoolVar(&trace_lvl, "trace", false, "Set logging to trace") rootCmd.PersistentFlags().StringVar(&cwhub.HubBranch, "branch", "", "Override hub branch on github") if err := rootCmd.PersistentFlags().MarkHidden("branch"); err != nil { diff --git a/cmd/crowdsec-cli/metrics_table.go b/cmd/crowdsec-cli/metrics_table.go index 6cdd0a077..69706c7ac 100644 --- a/cmd/crowdsec-cli/metrics_table.go +++ b/cmd/crowdsec-cli/metrics_table.go @@ -199,7 +199,7 @@ func lapiStatsTable(out io.Writer, stats map[string]map[string]int) { } if numRows > 0 { - renderTableTitle(out, "\nLocal Api Metrics:") + renderTableTitle(out, "\nLocal API Metrics:") t.Render() } } @@ -213,7 +213,7 @@ func lapiMachineStatsTable(out io.Writer, stats map[string]map[string]map[string numRows := lapiMetricsToTable(t, stats) if numRows > 0 { - renderTableTitle(out, "\nLocal Api Machines Metrics:") + renderTableTitle(out, "\nLocal API Machines Metrics:") t.Render() } } @@ -227,7 +227,7 @@ func lapiBouncerStatsTable(out io.Writer, stats map[string]map[string]map[string numRows := lapiMetricsToTable(t, stats) if numRows > 0 { - renderTableTitle(out, "\nLocal Api Bouncers Metrics:") + renderTableTitle(out, "\nLocal API Bouncers Metrics:") t.Render() } } @@ -253,7 +253,7 @@ func lapiDecisionStatsTable(out io.Writer, stats map[string]struct { } if numRows > 0 { - renderTableTitle(out, "\nLocal Api Bouncers Decisions:") + renderTableTitle(out, "\nLocal API Bouncers Decisions:") t.Render() } } @@ -280,7 +280,7 @@ func decisionStatsTable(out io.Writer, stats map[string]map[string]map[string]in } if numRows > 0 { - renderTableTitle(out, "\nLocal Api Decisions:") + renderTableTitle(out, "\nLocal API Decisions:") t.Render() } } @@ -301,7 +301,7 @@ func alertStatsTable(out io.Writer, stats map[string]int) { } if numRows > 0 { - renderTableTitle(out, "\nLocal Api Alerts:") + renderTableTitle(out, "\nLocal API Alerts:") t.Render() } } diff --git a/pkg/csprofiles/csprofiles.go b/pkg/csprofiles/csprofiles.go index 70dea3d7a..7668e70cb 100644 --- a/pkg/csprofiles/csprofiles.go +++ b/pkg/csprofiles/csprofiles.go @@ -102,7 +102,7 @@ func (Profile *Runtime) GenerateDecisionFromProfile(Alert *models.Alert) ([]*mod for _, refDecision := range Profile.Cfg.Decisions { decision := models.Decision{} - /*the reference decision from profile is in sumulated mode */ + /*the reference decision from profile is in simulated mode */ if refDecision.Simulated != nil && *refDecision.Simulated { decision.Simulated = new(bool) *decision.Simulated = true diff --git a/pkg/leakybucket/manager_load.go b/pkg/leakybucket/manager_load.go index 45485e4f9..40c5eb8d6 100644 --- a/pkg/leakybucket/manager_load.go +++ b/pkg/leakybucket/manager_load.go @@ -268,7 +268,7 @@ func LoadBuckets(cscfg *csconfig.CrowdsecServiceCfg, files []string, tomb *tomb. return nil, nil, fmt.Errorf("unable to load alert context: %s", err) } - log.Warningf("Loaded %d scenarios", len(ret)) + log.Infof("Loaded %d scenarios", len(ret)) return ret, response, nil } diff --git a/test/bats/01_cscli.bats b/test/bats/01_cscli.bats index ef825d2a8..0664c5691 100644 --- a/test/bats/01_cscli.bats +++ b/test/bats/01_cscli.bats @@ -227,7 +227,7 @@ teardown() { rune -0 cscli metrics assert_output --partial "Route" assert_output --partial '/v1/watchers/login' - assert_output --partial "Local Api Metrics:" + assert_output --partial "Local API Metrics:" } @test "'cscli completion' with or without configuration file" { diff --git a/test/bats/04_nocapi.bats b/test/bats/04_nocapi.bats index 3e282f1fe..388277cca 100644 --- a/test/bats/04_nocapi.bats +++ b/test/bats/04_nocapi.bats @@ -78,5 +78,5 @@ teardown() { rune -0 cscli metrics assert_output --partial "Route" assert_output --partial '/v1/watchers/login' - assert_output --partial "Local Api Metrics:" + assert_output --partial "Local API Metrics:" } diff --git a/test/bats/10_bouncers.bats b/test/bats/10_bouncers.bats index 8db64ff5e..79ba0eda8 100644 --- a/test/bats/10_bouncers.bats +++ b/test/bats/10_bouncers.bats @@ -30,7 +30,7 @@ teardown() { @test "we can add one bouncer, and delete it" { rune -0 cscli bouncers add ciTestBouncer - assert_output --partial "Api key for 'ciTestBouncer':" + assert_output --partial "API key for 'ciTestBouncer':" rune -0 cscli bouncers delete ciTestBouncer rune -0 cscli bouncers list -o json assert_output '[]'