Blob Blame History Raw
From 8bc6c37607c3908976e502c1b6a3d9b1a79c010a Mon Sep 17 00:00:00 2001
From: Peter Varkoly <varkoly@suse.com>
Date: Mon, 30 Sep 2019 14:31:39 +0200
Subject: [PATCH] Adapt azure-lb Resource Agent to support socat usage too

---
 heartbeat/azure-lb | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/heartbeat/azure-lb b/heartbeat/azure-lb
index 35d364be7..5ee767474 100755
--- a/heartbeat/azure-lb
+++ b/heartbeat/azure-lb
@@ -53,9 +53,11 @@ Resource agent to answer Azure Load Balancer health probe requests
 
 <parameter name="nc">
 <longdesc lang="en">
-The full name of the nc binary.
+The full path of the used binary. This can be nc or socat path.
+The default is /usr/bin/nc.
+If you need /usr/bin/socat this parameter should be set.
 </longdesc>
-<shortdesc lang="en">Full path name of the nc binary</shortdesc>
+<shortdesc lang="en">Full path of the used binary (nc or socat are allowed)</shortdesc>
 <content type="string" default="${OCF_RESKEY_nc_default}"/>
 </parameter>
 
@@ -100,6 +102,10 @@ lb_monitor() {
 
 lb_start() {
 	cmd="$OCF_RESKEY_nc -l -k $OCF_RESKEY_port"
+	if [ $( basename $OCF_RESKEY_nc ) = 'socat' ]; then
+		#socat has different parameters
+		cmd="$OCF_RESKEY_nc -U TCP-LISTEN:$OCF_RESKEY_port,backlog=10,fork,reuseaddr /dev/null"
+	fi
 	if ! lb_monitor; then
 		ocf_log debug "Starting $process: $cmd"
 		# Execute the command as created above