docker: skip temporary installation of disabled items (#2018)
This commit is contained in:
parent
e37d09e5b4
commit
3bf95e1a83
|
@ -106,7 +106,37 @@ cscli_if_clean() {
|
||||||
if cscli "$1" inspect "$obj" -o json | yq -e '.tainted // false' >/dev/null 2>&1; then
|
if cscli "$1" inspect "$obj" -o json | yq -e '.tainted // false' >/dev/null 2>&1; then
|
||||||
echo "Object $1/$obj is tainted, skipping"
|
echo "Object $1/$obj is tainted, skipping"
|
||||||
else
|
else
|
||||||
cscli "$1" "$2" "$obj"
|
# # Too verbose? Only show errors if not in debug mode
|
||||||
|
# if [ "$DEBUG" != "true" ]; then
|
||||||
|
# error_only=--error
|
||||||
|
# fi
|
||||||
|
error_only=""
|
||||||
|
echo "Running: cscli $error_only $1 $2 \"$obj\""
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
cscli $error_only "$1" "$2" "$obj"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Output the difference between two lists
|
||||||
|
# of items separated by spaces
|
||||||
|
difference() {
|
||||||
|
list1="$1"
|
||||||
|
list2="$2"
|
||||||
|
|
||||||
|
# split into words
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
set -- $list1
|
||||||
|
for item in "$@"; do
|
||||||
|
found=false
|
||||||
|
for i in $list2; do
|
||||||
|
if [ "$item" = "$i" ]; then
|
||||||
|
found=true
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ "$found" = false ]; then
|
||||||
|
echo "$item"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -267,22 +297,22 @@ cscli_if_clean parsers install crowdsecurity/cri-logs
|
||||||
|
|
||||||
if [ "$COLLECTIONS" != "" ]; then
|
if [ "$COLLECTIONS" != "" ]; then
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
cscli_if_clean collections install "$COLLECTIONS"
|
cscli_if_clean collections install "$(difference "$COLLECTIONS" "$DISABLE_COLLECTIONS")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$PARSERS" != "" ]; then
|
if [ "$PARSERS" != "" ]; then
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
cscli_if_clean parsers install "$PARSERS"
|
cscli_if_clean parsers install "$(difference "$PARSERS" "$DISABLE_PARSERS")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$SCENARIOS" != "" ]; then
|
if [ "$SCENARIOS" != "" ]; then
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
cscli_if_clean scenarios install "$SCENARIOS"
|
cscli_if_clean scenarios install "$(difference "$SCENARIOS" "$DISABLE_SCENARIOS")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$POSTOVERFLOWS" != "" ]; then
|
if [ "$POSTOVERFLOWS" != "" ]; then
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
cscli_if_clean postoverflows install "$POSTOVERFLOWS"
|
cscli_if_clean postoverflows install "$(difference "$POSTOVERFLOWS" "$DISABLE_POSTOVERFLOWS")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## Remove collections, parsers, scenarios & postoverflows
|
## Remove collections, parsers, scenarios & postoverflows
|
||||||
|
|
Loading…
Reference in a new issue