diff --git a/Dockerfile b/Dockerfile index 69ed319a3..3b95ca3c4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ RUN apk add --no-cache git g++ gcc libc-dev make bash gettext binutils-gold core cd re2-${RE2_VERSION} && \ make install && \ echo "githubciXXXXXXXXXXXXXXXXXXXXXXXX" > /etc/machine-id && \ - go install github.com/mikefarah/yq/v4@v4.34.1 + go install github.com/mikefarah/yq/v4@v4.40.4 COPY . . diff --git a/Dockerfile.debian b/Dockerfile.debian index 02e0d017d..2f116aa73 100644 --- a/Dockerfile.debian +++ b/Dockerfile.debian @@ -20,7 +20,7 @@ RUN apt-get update && \ make && \ make install && \ echo "githubciXXXXXXXXXXXXXXXXXXXXXXXX" > /etc/machine-id && \ - go install github.com/mikefarah/yq/v4@v4.34.1 + go install github.com/mikefarah/yq/v4@v4.40.4 COPY . . diff --git a/cmd/crowdsec-cli/lapi.go b/cmd/crowdsec-cli/lapi.go index 96da17913..d9dc52f27 100644 --- a/cmd/crowdsec-cli/lapi.go +++ b/cmd/crowdsec-cli/lapi.go @@ -245,7 +245,7 @@ func NewLapiContextCmd() *cobra.Command { if err := csConfig.LoadCrowdsec(); err != nil { fileNotFoundMessage := fmt.Sprintf("failed to open context file: open %s: no such file or directory", csConfig.Crowdsec.ConsoleContextPath) if err.Error() != fileNotFoundMessage { - return fmt.Errorf("unable to start CrowdSec agent: %w", err) + return fmt.Errorf("unable to load CrowdSec agent configuration: %w", err) } } if csConfig.DisableAgent { @@ -423,7 +423,15 @@ cscli lapi context detect crowdsecurity/sshd-logs cmdContextDelete := &cobra.Command{ Use: "delete", - Deprecated: "please manually edit the context file.", + DisableAutoGenTag: true, + RunE: func(_ *cobra.Command, _ []string) error { + filePath := csConfig.Crowdsec.ConsoleContextPath + if filePath == "" { + filePath = "the context file" + } + fmt.Printf("Command \"delete\" is deprecated, please manually edit %s.", filePath) + return nil + }, } cmdContext.AddCommand(cmdContextDelete) diff --git a/test/bats.mk b/test/bats.mk index cb452e2b8..4fe1dce91 100644 --- a/test/bats.mk +++ b/test/bats.mk @@ -68,8 +68,8 @@ bats-check-requirements: # Install/update some of the tools required to run the tests bats-update-tools: - # yq v4.34.1 - GOBIN=$(TEST_DIR)/tools go install github.com/mikefarah/yq/v4@5ef537f3fd1a9437aa3ee44c32c6459a126efdc4 + # yq v4.40.4 + GOBIN=$(TEST_DIR)/tools go install github.com/mikefarah/yq/v4@1c3d55106075bd37df197b4bc03cb4a413fdb903 # cfssl v1.6.4 GOBIN=$(TEST_DIR)/tools go install github.com/cloudflare/cfssl/cmd/cfssl@b4d0d877cac528f63db39dfb62d5c96cd3a32a0b GOBIN=$(TEST_DIR)/tools go install github.com/cloudflare/cfssl/cmd/cfssljson@b4d0d877cac528f63db39dfb62d5c96cd3a32a0b diff --git a/test/lib/setup_file.sh b/test/lib/setup_file.sh index d841bbe7c..1aca32fa6 100755 --- a/test/lib/setup_file.sh +++ b/test/lib/setup_file.sh @@ -242,19 +242,11 @@ export -f assert_stderr_line # remove all installed items and data hub_purge_all() { local CONFIG_DIR + local itemtype CONFIG_DIR=$(dirname "$CONFIG_YAML") - rm -rf \ - "$CONFIG_DIR"/collections/* \ - "$CONFIG_DIR"/parsers/*/* \ - "$CONFIG_DIR"/scenarios/* \ - "$CONFIG_DIR"/postoverflows/* \ - "$CONFIG_DIR"/contexts/* - rm -rf \ - "$CONFIG_DIR"/hub/collections/* \ - "$CONFIG_DIR"/hub/parsers/*/* \ - "$CONFIG_DIR"/hub/scenarios/* \ - "$CONFIG_DIR"/hub/postoverflows/* \ - "$CONFIG_DIR"/hub/contexts/* + for itemtype in $(cscli hub types -o raw); do + rm -rf "$CONFIG_DIR"/"${itemtype:?}"/* "$CONFIG_DIR"/hub/"${itemtype:?}"/* + done local DATA_DIR DATA_DIR=$(config_get .config_paths.data_dir) # should remove everything except the db (find $DATA_DIR -not -name "crowdsec.db*" -delete),