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

This commit is contained in:
Thibault "bui" Koechlin 2020-07-30 12:15:15 +02:00 committed by GitHub
parent b19046939c
commit f8abb01bbc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 3 deletions

View file

@ -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")

View file

@ -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")

View file

@ -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)

View file

@ -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")

View file

@ -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