Blame SOURCES/bz1259595-redis-client-passwd-support.patch

659c12
commit fe53056f225fadae184a0ab79f1f96430854812f
659c12
Author: David Vossel <dvossel@redhat.com>
659c12
Date:   Thu Aug 13 14:11:30 2015 -0400
659c12
659c12
    High: redis: use required client pass word when set
659c12
659c12
diff --git a/heartbeat/redis b/heartbeat/redis
659c12
index e1d0795..65abb2a 100755
659c12
--- a/heartbeat/redis
659c12
+++ b/heartbeat/redis
659c12
@@ -218,7 +218,11 @@ function set_score()
659c12
 
659c12
 function redis_client() {
659c12
 	ocf_log debug "redis_client: '$REDIS_CLIENT' -s '$REDIS_SOCKET' $@"
659c12
-	"$REDIS_CLIENT" -s "$REDIS_SOCKET" "$@" | sed 's/\r//'
659c12
+	if [ -n "$clientpasswd" ]; then
659c12
+		"$REDIS_CLIENT" -s "$REDIS_SOCKET" -a "$clientpasswd" "$@" | sed 's/\r//'
659c12
+	else 
659c12
+		"$REDIS_CLIENT" -s "$REDIS_SOCKET" "$@" | sed 's/\r//'
659c12
+	fi
659c12
 }
659c12
 
659c12
 function simple_status() {
659c12
@@ -487,6 +491,9 @@ function validate() {
659c12
 }
659c12
 
659c12
 NODENAME=$(ocf_local_nodename)
659c12
+if [ -f "$REDIS_CONFIG" ]; then
659c12
+	clientpasswd="$(cat $REDIS_CONFIG | sed -n -e 's/^\s*requirepass\s*\(.*\)\s*$/\1/p' | tail -n 1)"
659c12
+fi
659c12
 
659c12
 ocf_log debug "action=${1:-$__OCF_ACTION} notify_type=${OCF_RESKEY_CRM_meta_notify_type} notify_operation=${OCF_RESKEY_CRM_meta_notify_operation} master_host=${OCF_RESKEY_CRM_meta_notify_master_uname} slave_host=${OCF_RESKEY_CRM_meta_notify_slave_uname} promote_host=${OCF_RESKEY_CRM_meta_notify_promote_uname} demote_host=${OCF_RESKEY_CRM_meta_notify_demote_uname}; params: bin=${OCF_RESKEY_bin} client_bin=${OCF_RESKEY_client_bin} config=${OCF_RESKEY_config} user=${OCF_RESKEY_user} rundir=${OCF_RESKEY_rundir} port=${OCF_RESKEY_port}"
659c12