Explorar el Código

Advise user to perform a reload when appropriate (#163)

Thibault "bui" Koechlin hace 5 años
padre
commit
f8abb01bbc

+ 3 - 0
cmd/crowdsec-cli/install.go

@@ -65,6 +65,9 @@ you should [update cscli](./cscli_update.md).
 			}
 			return nil
 		},
+		PersistentPostRun: func(cmd *cobra.Command, args []string) {
+			log.Infof("Run 'systemctl reload crowdsec' for the new configuration to be effective.")
+		},
 	}
 	cmdInstall.PersistentFlags().BoolVarP(&download_only, "download-only", "d", false, "Only download packages, don't enable")
 	cmdInstall.PersistentFlags().BoolVar(&force_install, "force", false, "Force install : Overwrite tainted and outdated files")

+ 3 - 0
cmd/crowdsec-cli/remove.go

@@ -58,6 +58,9 @@ func NewRemoveCmd() *cobra.Command {
 			}
 			return nil
 		},
+		PersistentPostRun: func(cmd *cobra.Command, args []string) {
+			log.Infof("Run 'systemctl reload crowdsec' for the new configuration to be effective.")
+		},
 	}
 	cmdRemove.PersistentFlags().BoolVar(&purge_remove, "purge", false, "Delete source file in ~/.cscli/hub/ too")
 	cmdRemove.PersistentFlags().BoolVar(&remove_all, "all", false, "Delete all the files in selected scope")

+ 6 - 1
cmd/crowdsec-cli/simulation.go

@@ -95,7 +95,7 @@ func simulationStatus() error {
 
 func NewSimulationCmds() *cobra.Command {
 	var cmdSimulation = &cobra.Command{
-		Use:   "simulation  enable|disable [scenario_name]",
+		Use:   "simulation enable|disable [scenario_name]",
 		Short: "",
 		Long:  ``,
 		PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
@@ -104,6 +104,9 @@ func NewSimulationCmds() *cobra.Command {
 			}
 			return nil
 		},
+		PersistentPostRun: func(cmd *cobra.Command, args []string) {
+			log.Infof("Run 'systemctl reload crowdsec' for the new configuration to be effective.")
+		},
 	}
 	cmdSimulation.Flags().SortFlags = false
 	cmdSimulation.PersistentFlags().SortFlags = false
@@ -215,6 +218,8 @@ func NewSimulationCmds() *cobra.Command {
 				log.Fatalf(err.Error())
 			}
 		},
+		PersistentPostRun: func(cmd *cobra.Command, args []string) {
+		},
 	}
 	cmdSimulation.AddCommand(cmdSimulationStatus)
 

+ 3 - 0
cmd/crowdsec-cli/upgrade.go

@@ -109,6 +109,9 @@ cscli upgrade --force # Overwrite tainted configuration
 			}
 			//fmt.Println("upgrade all ?!: " + strings.Join(args, " "))
 		},
+		PersistentPostRun: func(cmd *cobra.Command, args []string) {
+			log.Infof("Run 'systemctl reload crowdsec' for the new configuration to be effective.")
+		},
 	}
 	cmdUpgrade.PersistentFlags().BoolVar(&upgrade_all, "all", false, "Upgrade all configuration in scope")
 	cmdUpgrade.PersistentFlags().BoolVar(&force_upgrade, "force", false, "Overwrite existing files, even if tainted")

+ 1 - 2
scripts/test_env.sh

@@ -78,7 +78,6 @@ copy_files() {
 	cp "./cmd/crowdsec/crowdsec" "$BASE"
 	cp "./cmd/crowdsec-cli/cscli" "$BASE"
 	cp -r "./config/patterns" "$CONFIG_DIR"
-	cp -r "./data/" "$BASE"
 	cp -r "./plugins/" "$BASE"
 }
 
@@ -116,4 +115,4 @@ usage() {
 
 
 
-main
+main