Minor cleanup and dead code removal (#2166)
This commit is contained in:
parent
9a5a937695
commit
0c5d233563
7 changed files with 4 additions and 13 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -40,7 +40,6 @@ plugins/notifications/dummy/notification-dummy
|
|||
|
||||
# Release stuff
|
||||
crowdsec-v*
|
||||
pkg/cwhub/hubdir/.index.json
|
||||
msi
|
||||
*.msi
|
||||
**/*.nupkg
|
||||
|
|
|
@ -238,7 +238,6 @@ It is meant to allow you to manage bans, parsers/scenarios/etc, api and generall
|
|||
rootCmd.AddCommand(NewDashboardCmd())
|
||||
rootCmd.AddCommand(NewDecisionsCmd())
|
||||
rootCmd.AddCommand(NewAlertsCmd())
|
||||
// rootCmd.AddCommand(NewInspectCmd())
|
||||
rootCmd.AddCommand(NewSimulationCmds())
|
||||
rootCmd.AddCommand(NewBouncersCmd())
|
||||
rootCmd.AddCommand(NewMachinesCmd())
|
||||
|
|
|
@ -192,7 +192,7 @@ if isfalse "$DISABLE_LOCAL_API"; then
|
|||
# generate local agent credentials (even if agent is disabled, cscli needs a
|
||||
# connection to the API)
|
||||
if ( isfalse "$USE_TLS" || [ "$CLIENT_CERT_FILE" = "" ] ); then
|
||||
if yq -e '.login==strenv(CUSTOM_HOSTNAME)' "$lapi_credentials_path" && ( cscli machines list -o json | yq -e 'any_c(.machineId==strenv(CUSTOM_HOSTNAME))' >/dev/null ); then
|
||||
if yq -e '.login==strenv(CUSTOM_HOSTNAME)' "$lapi_credentials_path" >/dev/null && ( cscli machines list -o json | yq -e 'any_c(.machineId==strenv(CUSTOM_HOSTNAME))' >/dev/null ); then
|
||||
echo "Local agent already registered"
|
||||
else
|
||||
echo "Generate local agent credentials"
|
||||
|
|
|
@ -91,9 +91,6 @@ func (c *Controller) DeleteDecisionById(gctx *gin.Context) {
|
|||
}
|
||||
//transform deleted decisions to be sendable to capi
|
||||
deletedDecisions := FormatDecisions(deletedFromDB)
|
||||
if err != nil {
|
||||
log.Warningf("failed to format decisions: %v", err)
|
||||
}
|
||||
|
||||
if c.DecisionDeleteChan != nil {
|
||||
c.DecisionDeleteChan <- deletedDecisions
|
||||
|
@ -115,9 +112,6 @@ func (c *Controller) DeleteDecisions(gctx *gin.Context) {
|
|||
}
|
||||
//transform deleted decisions to be sendable to capi
|
||||
deletedDecisions := FormatDecisions(deletedFromDB)
|
||||
if err != nil {
|
||||
log.Warningf("failed to format decisions: %v", err)
|
||||
}
|
||||
|
||||
if c.DecisionDeleteChan != nil {
|
||||
c.DecisionDeleteChan <- deletedDecisions
|
||||
|
|
|
@ -108,7 +108,7 @@ func NewDefaultConfig() *Config {
|
|||
ListenURI: "127.0.0.1:8080",
|
||||
UseForwardedForHeaders: false,
|
||||
OnlineClient: &OnlineApiClientCfg{
|
||||
CredentialsFilePath: DefaultConfigPath("config", "online-api-secrets.yaml"),
|
||||
CredentialsFilePath: DefaultConfigPath("online_api_credentials.yaml"),
|
||||
},
|
||||
},
|
||||
CTI: &CTICfg{
|
||||
|
|
|
@ -30,7 +30,7 @@ func (pb *PluginBroker) CreateCmd(binaryPath string) (*exec.Cmd, error) {
|
|||
var err error
|
||||
cmd := exec.Command(binaryPath)
|
||||
if pb.pluginProcConfig.User != "" || pb.pluginProcConfig.Group != "" {
|
||||
if !(pb.pluginProcConfig.User != "" && pb.pluginProcConfig.Group != "") {
|
||||
if pb.pluginProcConfig.User == "" || pb.pluginProcConfig.Group == "" {
|
||||
return nil, errors.New("while getting process attributes: both plugin user and group must be set")
|
||||
}
|
||||
cmd.SysProcAttr, err = getProcessAttr(pb.pluginProcConfig.User, pb.pluginProcConfig.Group)
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
|
||||
"github.com/antonmedv/expr/parser"
|
||||
"github.com/google/uuid"
|
||||
"github.com/sirupsen/logrus"
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/antonmedv/expr"
|
||||
|
@ -136,7 +135,7 @@ type expression struct {
|
|||
Run display the content of each variable of a filter by evaluating them with expr,
|
||||
again the expr environment given in parameter
|
||||
*/
|
||||
func (e *ExprDebugger) Run(logger *logrus.Entry, filterResult bool, exprEnv map[string]interface{}) {
|
||||
func (e *ExprDebugger) Run(logger *log.Entry, filterResult bool, exprEnv map[string]interface{}) {
|
||||
if len(e.expression) == 0 {
|
||||
logger.Tracef("no variable to eval for filter '%s'", e.filter)
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue