From ca424a34e6f94261d681a588e6403673b965fc28 Mon Sep 17 00:00:00 2001 From: Darko Poljak Date: Mon, 28 Nov 2016 08:13:59 +0100 Subject: [PATCH] Fix shell IPv6 testing (for -e). --- cdist/conf/type/__file/gencode-local | 3 +-- cdist/conf/type/__jail_freebsd10/gencode-local | 3 +-- cdist/conf/type/__jail_freebsd9/gencode-local | 3 +-- cdist/conf/type/__pf_ruleset/gencode-local | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/cdist/conf/type/__file/gencode-local b/cdist/conf/type/__file/gencode-local index c9e0fa2c..4caa6df6 100755 --- a/cdist/conf/type/__file/gencode-local +++ b/cdist/conf/type/__file/gencode-local @@ -67,8 +67,7 @@ DONE if [ "$upload_file" ]; then echo upload >> "$__messages_out" # IPv6 fix - echo "${__target_host}" | grep -q -E '^[0-9a-fA-F:]+$' - if [ $? -eq 0 ] + if $(echo "${__target_host}" | grep -q -E '^[0-9a-fA-F:]+$') then my_target_host="[${__target_host}]" else diff --git a/cdist/conf/type/__jail_freebsd10/gencode-local b/cdist/conf/type/__jail_freebsd10/gencode-local index bdd0ffd7..8c1687a9 100755 --- a/cdist/conf/type/__jail_freebsd10/gencode-local +++ b/cdist/conf/type/__jail_freebsd10/gencode-local @@ -44,8 +44,7 @@ basepresent="$(cat "$__object/explorer/basepresent")" if [ "$state" = "present" ]; then if [ "$basepresent" = "NONE" ]; then # IPv6 fix - echo "${__target_host}" | grep -q -E '^[0-9a-fA-F:]+$' - if [ $? -eq 0 ] + if $(echo "${__target_host}" | grep -q -E '^[0-9a-fA-F:]+$') then my_target_host="[${__target_host}]" else diff --git a/cdist/conf/type/__jail_freebsd9/gencode-local b/cdist/conf/type/__jail_freebsd9/gencode-local index ce9b215e..67420a6f 100755 --- a/cdist/conf/type/__jail_freebsd9/gencode-local +++ b/cdist/conf/type/__jail_freebsd9/gencode-local @@ -40,8 +40,7 @@ basepresent="$(cat "$__object/explorer/basepresent")" if [ "$state" = "present" ]; then if [ "$basepresent" = "NONE" ]; then # IPv6 fix - echo "${__target_host}" | grep -q -E '^[0-9a-fA-F:]+$' - if [ $? -eq 0 ] + if $(echo "${__target_host}" | grep -q -E '^[0-9a-fA-F:]+$') then my_target_host="[${__target_host}]" else diff --git a/cdist/conf/type/__pf_ruleset/gencode-local b/cdist/conf/type/__pf_ruleset/gencode-local index d14a6045..2db2ae06 100644 --- a/cdist/conf/type/__pf_ruleset/gencode-local +++ b/cdist/conf/type/__pf_ruleset/gencode-local @@ -60,8 +60,7 @@ case $uname in esac # IPv6 fix -echo "${__target_host}" | grep -q -E '^[0-9a-fA-F:]+$' -if [ $? -eq 0 ] +if $(echo "${__target_host}" | grep -q -E '^[0-9a-fA-F:]+$') then my_target_host="[${__target_host}]" else