cscli machines|bouncers|dashboard
error message clarification (#754)
This commit is contained in:
parent
446fd499c8
commit
88e1095478
|
@ -22,15 +22,16 @@ func NewBouncersCmd() *cobra.Command {
|
|||
/* ---- DECISIONS COMMAND */
|
||||
var cmdBouncers = &cobra.Command{
|
||||
Use: "bouncers [action]",
|
||||
Short: "Manage bouncers",
|
||||
Long: `
|
||||
Bouncers Management.
|
||||
|
||||
To list/add/delete bouncers
|
||||
Short: "Manage bouncers [requires local API]",
|
||||
Long: `To list/add/delete bouncers.
|
||||
Note: This command requires database direct access, so is intended to be run on Local API/master.
|
||||
`,
|
||||
Args: cobra.MinimumNArgs(1),
|
||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||
var err error
|
||||
if err := csConfig.LoadAPIServer(); err != nil || csConfig.DisableAPI {
|
||||
log.Fatal("Local API is disabled, please run this command on the local API machine")
|
||||
}
|
||||
if err := csConfig.LoadDBConfig(); err != nil {
|
||||
log.Fatalf(err.Error())
|
||||
}
|
||||
|
@ -119,7 +120,7 @@ cscli bouncers add MyBouncerName -l 24`,
|
|||
if csConfig.Cscli.Output == "human" {
|
||||
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 retrive it!\n")
|
||||
fmt.Print("Please keep this key since you will not be able to retrieve it!\n")
|
||||
} else if csConfig.Cscli.Output == "raw" {
|
||||
fmt.Printf("%s", apiKey)
|
||||
} else if csConfig.Cscli.Output == "json" {
|
||||
|
|
|
@ -28,11 +28,8 @@ func NewCapiCmd() *cobra.Command {
|
|||
Short: "Manage interaction with Central API (CAPI)",
|
||||
Args: cobra.MinimumNArgs(1),
|
||||
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
||||
if err := csConfig.LoadAPIServer(); err != nil {
|
||||
log.Fatalf(err.Error())
|
||||
}
|
||||
if csConfig.API.Server == nil {
|
||||
log.Fatalln("There is no API->server configuration")
|
||||
if err := csConfig.LoadAPIServer(); err != nil || csConfig.DisableAPI {
|
||||
log.Fatal("Local API is disabled, please run this command on the local API machine")
|
||||
}
|
||||
if csConfig.API.Server.OnlineClient == nil {
|
||||
log.Fatalf("no configuration for crowdsec API in '%s'", *csConfig.FilePath)
|
||||
|
|
|
@ -40,9 +40,11 @@ func NewDashboardCmd() *cobra.Command {
|
|||
/* ---- UPDATE COMMAND */
|
||||
var cmdDashboard = &cobra.Command{
|
||||
Use: "dashboard [command]",
|
||||
Short: "Manage your metabase dashboard container",
|
||||
Long: `Install/Start/Stop/Remove a metabase container exposing dashboard and metrics.`,
|
||||
Args: cobra.ExactArgs(1),
|
||||
Short: "Manage your metabase dashboard container [requires local API]",
|
||||
Long: `Install/Start/Stop/Remove a metabase container exposing dashboard and metrics.
|
||||
Note: This command requires database direct access, so is intended to be run on Local API/master.
|
||||
`,
|
||||
Args: cobra.ExactArgs(1),
|
||||
Example: `
|
||||
cscli dashboard setup
|
||||
cscli dashboard start
|
||||
|
@ -50,12 +52,17 @@ cscli dashboard stop
|
|||
cscli dashboard remove
|
||||
`,
|
||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||
if err := csConfig.LoadAPIServer(); err != nil || csConfig.DisableAPI {
|
||||
log.Fatal("Local API is disabled, please run this command on the local API machine")
|
||||
}
|
||||
|
||||
metabaseConfigFolderPath := filepath.Join(csConfig.ConfigPaths.ConfigDir, metabaseConfigFolder)
|
||||
metabaseConfigPath = filepath.Join(metabaseConfigFolderPath, metabaseConfigFile)
|
||||
if err := os.MkdirAll(metabaseConfigFolderPath, os.ModePerm); err != nil {
|
||||
log.Fatalf(err.Error())
|
||||
}
|
||||
if err := csConfig.LoadDBConfig(); err != nil {
|
||||
log.Errorf("This command requires direct database access (must be run on the local API machine)")
|
||||
log.Fatalf(err.Error())
|
||||
}
|
||||
|
||||
|
|
|
@ -80,18 +80,19 @@ func NewMachinesCmd() *cobra.Command {
|
|||
/* ---- DECISIONS COMMAND */
|
||||
var cmdMachines = &cobra.Command{
|
||||
Use: "machines [action]",
|
||||
Short: "Manage local API machines",
|
||||
Long: `
|
||||
Machines Management.
|
||||
|
||||
To list/add/delete/validate machines
|
||||
Short: "Manage local API machines [requires local API]",
|
||||
Long: `To list/add/delete/validate machines.
|
||||
Note: This command requires database direct access, so is intended to be run on the local API machine.
|
||||
`,
|
||||
Example: `cscli machines [action]`,
|
||||
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||
if err := csConfig.LoadAPIServer(); err != nil || csConfig.DisableAPI {
|
||||
log.Fatal("Local API is disabled, please run this command on the local API machine")
|
||||
}
|
||||
if err := csConfig.LoadDBConfig(); err != nil {
|
||||
log.Errorf("This command requires direct database access (must be run on the local API machine)")
|
||||
log.Fatalf(err.Error())
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -101,9 +102,8 @@ To list/add/delete/validate machines
|
|||
Long: `List `,
|
||||
Example: `cscli machines list`,
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||
PreRun: func(cmd *cobra.Command, args []string) {
|
||||
var err error
|
||||
|
||||
dbClient, err = database.NewClient(csConfig.DbConfig)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to create new database client: %s", err)
|
||||
|
@ -164,7 +164,7 @@ cscli machines add --auto
|
|||
cscli machines add MyTestMachine --auto
|
||||
cscli machines add MyTestMachine --password MyPassword
|
||||
`,
|
||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||
PreRun: func(cmd *cobra.Command, args []string) {
|
||||
var err error
|
||||
dbClient, err = database.NewClient(csConfig.DbConfig)
|
||||
if err != nil {
|
||||
|
@ -264,7 +264,7 @@ cscli machines add MyTestMachine --password MyPassword
|
|||
Short: "delete machines",
|
||||
Example: `cscli machines delete <machine_name>`,
|
||||
Args: cobra.ExactArgs(1),
|
||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||
PreRun: func(cmd *cobra.Command, args []string) {
|
||||
var err error
|
||||
dbClient, err = database.NewClient(csConfig.DbConfig)
|
||||
if err != nil {
|
||||
|
@ -290,7 +290,7 @@ cscli machines add MyTestMachine --password MyPassword
|
|||
Long: `validate a machine to access the local API.`,
|
||||
Example: `cscli machines validate <machine_name>`,
|
||||
Args: cobra.ExactArgs(1),
|
||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||
PreRun: func(cmd *cobra.Command, args []string) {
|
||||
var err error
|
||||
dbClient, err = database.NewClient(csConfig.DbConfig)
|
||||
if err != nil {
|
||||
|
|
|
@ -132,7 +132,7 @@ func ListItem(itemType string, args []string) {
|
|||
func InstallItem(name string, obtype string, force bool) {
|
||||
it := cwhub.GetItem(obtype, name)
|
||||
if it == nil {
|
||||
log.Fatalf("unable to retrive item : %s", name)
|
||||
log.Fatalf("unable to retrieve item : %s", name)
|
||||
}
|
||||
item := *it
|
||||
if downloadOnly && item.Downloaded && item.UpToDate {
|
||||
|
|
|
@ -15,6 +15,18 @@ If you spotted some mistakes in the documentation or have improvement suggestion
|
|||
Let us as well know if you have some improvement suggestions !
|
||||
|
||||
|
||||
<details>
|
||||
<summary>Preview your documentation changes locally</summary>
|
||||
|
||||
```bash
|
||||
python3 -m venv cs-env
|
||||
source cs-env/bin/activate
|
||||
pip install -r docs/requirements.txt
|
||||
mkdocs serve
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
## Contributing to the code
|
||||
|
||||
|
|
|
@ -23,16 +23,16 @@ It is meant to allow you to manage bans, parsers/scenarios/etc, api and generall
|
|||
### SEE ALSO
|
||||
|
||||
* [cscli alerts](cscli_alerts.md) - Manage alerts
|
||||
* [cscli bouncers](cscli_bouncers.md) - Manage bouncers
|
||||
* [cscli bouncers](cscli_bouncers.md) - Manage bouncers [requires local API]
|
||||
* [cscli capi](cscli_capi.md) - Manage interaction with Central API (CAPI)
|
||||
* [cscli collections](cscli_collections.md) - Manage collections from hub
|
||||
* [cscli completion](cscli_completion.md) - Generate completion script
|
||||
* [cscli config](cscli_config.md) - Allows to view current config
|
||||
* [cscli dashboard](cscli_dashboard.md) - Manage your metabase dashboard container
|
||||
* [cscli dashboard](cscli_dashboard.md) - Manage your metabase dashboard container [requires local API]
|
||||
* [cscli decisions](cscli_decisions.md) - Manage decisions
|
||||
* [cscli hub](cscli_hub.md) - Manage Hub
|
||||
* [cscli lapi](cscli_lapi.md) - Manage interaction with Local API (LAPI)
|
||||
* [cscli machines](cscli_machines.md) - Manage local API machines
|
||||
* [cscli machines](cscli_machines.md) - Manage local API machines [requires local API]
|
||||
* [cscli metrics](cscli_metrics.md) - Display crowdsec prometheus metrics.
|
||||
* [cscli parsers](cscli_parsers.md) - Install/Remove/Upgrade/Inspect parser(s) from hub
|
||||
* [cscli postoverflows](cscli_postoverflows.md) - Install/Remove/Upgrade/Inspect postoverflow(s) from hub
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
## cscli bouncers
|
||||
|
||||
Manage bouncers
|
||||
Manage bouncers [requires local API]
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Bouncers Management.
|
||||
|
||||
To list/add/delete bouncers
|
||||
To list/add/delete bouncers.
|
||||
Note: This command requires database direct access, so is intended to be run on Local API/master.
|
||||
|
||||
|
||||
### Options
|
||||
|
|
|
@ -38,6 +38,6 @@ cscli bouncers add MyBouncerName -l 24
|
|||
|
||||
### SEE ALSO
|
||||
|
||||
* [cscli bouncers](cscli_bouncers.md) - Manage bouncers
|
||||
* [cscli bouncers](cscli_bouncers.md) - Manage bouncers [requires local API]
|
||||
|
||||
|
||||
|
|
|
@ -26,6 +26,6 @@ cscli bouncers delete MyBouncerName [flags]
|
|||
|
||||
### SEE ALSO
|
||||
|
||||
* [cscli bouncers](cscli_bouncers.md) - Manage bouncers
|
||||
* [cscli bouncers](cscli_bouncers.md) - Manage bouncers [requires local API]
|
||||
|
||||
|
||||
|
|
|
@ -36,6 +36,6 @@ cscli bouncers list
|
|||
|
||||
### SEE ALSO
|
||||
|
||||
* [cscli bouncers](cscli_bouncers.md) - Manage bouncers
|
||||
* [cscli bouncers](cscli_bouncers.md) - Manage bouncers [requires local API]
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
## cscli dashboard
|
||||
|
||||
Manage your metabase dashboard container
|
||||
Manage your metabase dashboard container [requires local API]
|
||||
|
||||
### Synopsis
|
||||
|
||||
Install/Start/Stop/Remove a metabase container exposing dashboard and metrics.
|
||||
Note: This command requires database direct access, so is intended to be run on Local API/master.
|
||||
|
||||
|
||||
### Examples
|
||||
|
||||
|
|
|
@ -41,6 +41,6 @@ cscli dashboard remove --force
|
|||
|
||||
### SEE ALSO
|
||||
|
||||
* [cscli dashboard](cscli_dashboard.md) - Manage your metabase dashboard container
|
||||
* [cscli dashboard](cscli_dashboard.md) - Manage your metabase dashboard container [requires local API]
|
||||
|
||||
|
||||
|
|
|
@ -46,6 +46,6 @@ cscli dashboard setup -l 0.0.0.0 -p 443 --password <password>
|
|||
|
||||
### SEE ALSO
|
||||
|
||||
* [cscli dashboard](cscli_dashboard.md) - Manage your metabase dashboard container
|
||||
* [cscli dashboard](cscli_dashboard.md) - Manage your metabase dashboard container [requires local API]
|
||||
|
||||
|
||||
|
|
|
@ -30,6 +30,6 @@ cscli dashboard start [flags]
|
|||
|
||||
### SEE ALSO
|
||||
|
||||
* [cscli dashboard](cscli_dashboard.md) - Manage your metabase dashboard container
|
||||
* [cscli dashboard](cscli_dashboard.md) - Manage your metabase dashboard container [requires local API]
|
||||
|
||||
|
||||
|
|
|
@ -30,6 +30,6 @@ cscli dashboard stop [flags]
|
|||
|
||||
### SEE ALSO
|
||||
|
||||
* [cscli dashboard](cscli_dashboard.md) - Manage your metabase dashboard container
|
||||
* [cscli dashboard](cscli_dashboard.md) - Manage your metabase dashboard container [requires local API]
|
||||
|
||||
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
## cscli machines
|
||||
|
||||
Manage local API machines
|
||||
Manage local API machines [requires local API]
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Machines Management.
|
||||
|
||||
To list/add/delete/validate machines
|
||||
To list/add/delete/validate machines.
|
||||
Note: This command requires database direct access, so is intended to be run on the local API machine.
|
||||
|
||||
|
||||
### Examples
|
||||
|
|
|
@ -46,6 +46,6 @@ cscli machines add MyTestMachine --password MyPassword
|
|||
|
||||
### SEE ALSO
|
||||
|
||||
* [cscli machines](cscli_machines.md) - Manage local API machines
|
||||
* [cscli machines](cscli_machines.md) - Manage local API machines [requires local API]
|
||||
|
||||
|
||||
|
|
|
@ -33,6 +33,6 @@ cscli machines delete <machine_name>
|
|||
|
||||
### SEE ALSO
|
||||
|
||||
* [cscli machines](cscli_machines.md) - Manage local API machines
|
||||
* [cscli machines](cscli_machines.md) - Manage local API machines [requires local API]
|
||||
|
||||
|
||||
|
|
|
@ -36,6 +36,6 @@ cscli machines list
|
|||
|
||||
### SEE ALSO
|
||||
|
||||
* [cscli machines](cscli_machines.md) - Manage local API machines
|
||||
* [cscli machines](cscli_machines.md) - Manage local API machines [requires local API]
|
||||
|
||||
|
||||
|
|
|
@ -36,6 +36,6 @@ cscli machines validate <machine_name>
|
|||
|
||||
### SEE ALSO
|
||||
|
||||
* [cscli machines](cscli_machines.md) - Manage local API machines
|
||||
* [cscli machines](cscli_machines.md) - Manage local API machines [requires local API]
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue