improve deprecation message with file location (#2662)
* better "lapi context" messages * func tests: include all items in hub_purge_all * docker + tests: update yq
This commit is contained in:
parent
a941576acc
commit
a851e14c88
5 changed files with 18 additions and 18 deletions
|
@ -15,7 +15,7 @@ RUN apk add --no-cache git g++ gcc libc-dev make bash gettext binutils-gold core
|
||||||
cd re2-${RE2_VERSION} && \
|
cd re2-${RE2_VERSION} && \
|
||||||
make install && \
|
make install && \
|
||||||
echo "githubciXXXXXXXXXXXXXXXXXXXXXXXX" > /etc/machine-id && \
|
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 . .
|
COPY . .
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ RUN apt-get update && \
|
||||||
make && \
|
make && \
|
||||||
make install && \
|
make install && \
|
||||||
echo "githubciXXXXXXXXXXXXXXXXXXXXXXXX" > /etc/machine-id && \
|
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 . .
|
COPY . .
|
||||||
|
|
||||||
|
|
|
@ -245,7 +245,7 @@ func NewLapiContextCmd() *cobra.Command {
|
||||||
if err := csConfig.LoadCrowdsec(); err != nil {
|
if err := csConfig.LoadCrowdsec(); err != nil {
|
||||||
fileNotFoundMessage := fmt.Sprintf("failed to open context file: open %s: no such file or directory", csConfig.Crowdsec.ConsoleContextPath)
|
fileNotFoundMessage := fmt.Sprintf("failed to open context file: open %s: no such file or directory", csConfig.Crowdsec.ConsoleContextPath)
|
||||||
if err.Error() != fileNotFoundMessage {
|
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 {
|
if csConfig.DisableAgent {
|
||||||
|
@ -423,7 +423,15 @@ cscli lapi context detect crowdsecurity/sshd-logs
|
||||||
|
|
||||||
cmdContextDelete := &cobra.Command{
|
cmdContextDelete := &cobra.Command{
|
||||||
Use: "delete",
|
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)
|
cmdContext.AddCommand(cmdContextDelete)
|
||||||
|
|
||||||
|
|
|
@ -68,8 +68,8 @@ bats-check-requirements:
|
||||||
|
|
||||||
# Install/update some of the tools required to run the tests
|
# Install/update some of the tools required to run the tests
|
||||||
bats-update-tools:
|
bats-update-tools:
|
||||||
# yq v4.34.1
|
# yq v4.40.4
|
||||||
GOBIN=$(TEST_DIR)/tools go install github.com/mikefarah/yq/v4@5ef537f3fd1a9437aa3ee44c32c6459a126efdc4
|
GOBIN=$(TEST_DIR)/tools go install github.com/mikefarah/yq/v4@1c3d55106075bd37df197b4bc03cb4a413fdb903
|
||||||
# cfssl v1.6.4
|
# 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/cfssl@b4d0d877cac528f63db39dfb62d5c96cd3a32a0b
|
||||||
GOBIN=$(TEST_DIR)/tools go install github.com/cloudflare/cfssl/cmd/cfssljson@b4d0d877cac528f63db39dfb62d5c96cd3a32a0b
|
GOBIN=$(TEST_DIR)/tools go install github.com/cloudflare/cfssl/cmd/cfssljson@b4d0d877cac528f63db39dfb62d5c96cd3a32a0b
|
||||||
|
|
|
@ -242,19 +242,11 @@ export -f assert_stderr_line
|
||||||
# remove all installed items and data
|
# remove all installed items and data
|
||||||
hub_purge_all() {
|
hub_purge_all() {
|
||||||
local CONFIG_DIR
|
local CONFIG_DIR
|
||||||
|
local itemtype
|
||||||
CONFIG_DIR=$(dirname "$CONFIG_YAML")
|
CONFIG_DIR=$(dirname "$CONFIG_YAML")
|
||||||
rm -rf \
|
for itemtype in $(cscli hub types -o raw); do
|
||||||
"$CONFIG_DIR"/collections/* \
|
rm -rf "$CONFIG_DIR"/"${itemtype:?}"/* "$CONFIG_DIR"/hub/"${itemtype:?}"/*
|
||||||
"$CONFIG_DIR"/parsers/*/* \
|
done
|
||||||
"$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/*
|
|
||||||
local DATA_DIR
|
local DATA_DIR
|
||||||
DATA_DIR=$(config_get .config_paths.data_dir)
|
DATA_DIR=$(config_get .config_paths.data_dir)
|
||||||
# should remove everything except the db (find $DATA_DIR -not -name "crowdsec.db*" -delete),
|
# should remove everything except the db (find $DATA_DIR -not -name "crowdsec.db*" -delete),
|
||||||
|
|
Loading…
Reference in a new issue