[Cluster-devel] [PATCH] resource-agents: nfsclient: fix wildcard status checks [RHEL5]

Fabio M. Di Nitto fdinitto at redhat.com
Fri Oct 28 04:46:02 UTC 2011


ACK

Fabio

On 10/28/2011 04:26 AM, Lon Hohberger wrote:
> Several permutations of nfsclients with options were
> not checked correctly due to bad pattern matching.
> 
> Resolves: rhbz#700103
> 
> Signed-off-by: Lon Hohberger <lhh at redhat.com>
> ---
>  rgmanager/src/resources/nfsclient.sh |   20 ++++++++++++--------
>  1 files changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/rgmanager/src/resources/nfsclient.sh b/rgmanager/src/resources/nfsclient.sh
> index 138370d..42ed2ce 100755
> --- a/rgmanager/src/resources/nfsclient.sh
> +++ b/rgmanager/src/resources/nfsclient.sh
> @@ -391,8 +391,8 @@ status|monitor)
>  		exportfs -v > $tmpfn
>  	fi
>  
> -        cat $tmpfn | tr -d "\n" | sed -e 's/([^)]*)/\n/g' | grep -iq \
> -		"^${OCF_RESKEY_path}[\t ]*.*${OCF_RESKEY_target_regexp}" 
> +        cat $tmpfn | tr -d "\n" | sed -e 's/([^)]*)/\n/g' | grep -Piq \
> +		"^${OCF_RESKEY_path}[\t ]+${OCF_RESKEY_target_regexp}" 
>  	rv=$? 
>  
>  	if [ $rv -eq 0 ]; then
> @@ -400,15 +400,19 @@ status|monitor)
>  		exit 0
>  	fi
>  
> -	declare OCF_RESKEY_target_tmp=$(clufindhostname -i "$OCF_RESKEY_target")
> +	declare OCF_RESKEY_target_tmp
> +	OCF_RESKEY_target_tmp=$(clufindhostname -i "$OCF_RESKEY_target")
>  	if [ $? -ne 0 ]; then
> -		[ "$OCF_RESKEY_use_cache" = "1" ] || rm -f $tmpfn
> -		ocf_log err "nfsclient:$OCF_RESKEY_name is missing!"
> -		exit 1
> +		OCF_RESKEY_target_tmp=$(clufindhostname -n "$OCF_RESKEY_target")
> +		if [ $? -ne 0 ]; then
> +			[ "$OCF_RESKEY_use_cache" = "1" ] || rm -f $tmpfn
> +			ocf_log err "nfsclient:$OCF_RESKEY_name is missing!"
> +			exit 1
> +		fi
>  	fi
>  
> -        cat $tmpfn | tr -d "\n" | sed -e 's/([^)]*)/\n/g' | grep -q \
> -		"^${OCF_RESKEY_path}[\t ]*.*${OCF_RESKEY_target_tmp}" 
> +        cat $tmpfn | tr -d "\n" | sed -e 's/([^)]*)/\n/g' | grep -Pq \
> +		"^${OCF_RESKEY_path}[\t ]+${OCF_RESKEY_target_tmp}" 
>  	rv=$? 
>  
>  	[ "$OCF_RESKEY_use_cache" = "1" ] || rm -f $tmpfn




More information about the Cluster-devel mailing list