Browse Source

__ipset: do not make use of grep -P flag as it is marked as experimental

master
mhameed 2 years ago
parent
commit
37e9e8c2a3
  1. 2
      cdist/conf/type/__ipset/explorer/content
  2. 4
      cdist/conf/type/__ipset/explorer/type
  3. 2
      cdist/conf/type/__ipset/files/ipsets-save
  4. 4
      cdist/conf/type/__ipset/gencode-remote

2
cdist/conf/type/__ipset/explorer/content vendored

@ -19,7 +19,7 @@
#
name="$__object_id"
if ipset -t list | grep -qP "Name: $name"; then
if ipset -t list | grep -qFx "Name: $name"; then
ipset list "$name" | sed '0,/^Members:/d'
else
echo "x_missing_x"

4
cdist/conf/type/__ipset/explorer/type vendored

@ -19,8 +19,8 @@
#
name="$__object_id"
if ipset -t list | grep -qP "Name: $name"; then
ipset -t list "$name" | grep -P "^Type: " | awk '{print $2}'
if ipset -t list | grep -qFx "Name: $name"; then
ipset -t list "$name" | grep "^Type: " | awk '{print $2}'
else
echo "x_missing_x"
fi

2
cdist/conf/type/__ipset/files/ipsets-save vendored

@ -22,7 +22,7 @@ mkdir -p /etc/ipset.d/
if [ -n "$1" ]; then
ipset save "$1" > "/etc/ipset.d/${1}.saved"
else
ipset -t list | grep -P "^Name:" | awk '{print $2}' | while read s; do
ipset -t list | grep "^Name:" | awk '{print $2}' | while read s; do
ipset save $s > /etc/ipset.d/$s.saved
done
fi

4
cdist/conf/type/__ipset/gencode-remote vendored

@ -54,7 +54,7 @@ esac
if [ "$state_should" = "present" ]; then
if [ -f "$p/add" ]; then
while read -r value; do
if ! grep -q "$value" "$e/content"; then
if ! grep -qFx "$value" "$e/content"; then
echo "ipset -! add $name $value"
needToSave=1
fi
@ -63,7 +63,7 @@ if [ "$state_should" = "present" ]; then
if [ -f "$p/del" ]; then
while read -r value; do
if grep -q "$value" "$e/content"; then
if grep -qFx "$value" "$e/content"; then
echo "ipset -! del $name $value"
needToSave=1
fi

Loading…
Cancel
Save