Blame SOURCES/bz2103370-ocf-tester-2-remove-deprecated-lrmd-lrmadmin-code.patch

4ff291
From 687aa646852d5fd5d4e811b2ec562ebffa15e23d Mon Sep 17 00:00:00 2001
4ff291
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
4ff291
Date: Thu, 14 Jul 2022 14:52:07 +0200
4ff291
Subject: [PATCH] ocf-tester: remove deprecated lrmd/lrmadmin code that hasnt
4ff291
 worked since pre-pacemaker days
4ff291
4ff291
---
4ff291
 tools/ocf-tester.8  | 12 ++-----
4ff291
 tools/ocf-tester.in | 81 ---------------------------------------------
4ff291
 2 files changed, 2 insertions(+), 91 deletions(-)
4ff291
4ff291
diff --git a/tools/ocf-tester.8 b/tools/ocf-tester.8
4ff291
index 850ec0be04..3f398282d2 100644
4ff291
--- a/tools/ocf-tester.8
4ff291
+++ b/tools/ocf-tester.8
4ff291
@@ -1,9 +1,9 @@
4ff291
-.TH OCF-TESTER "8" "January 2012" "Tool for testing if a cluster resource is OCF compliant" "System Administration Utilities"
4ff291
+.TH OCF-TESTER "8" "July 2022" "Tool for testing if a cluster resource is OCF compliant" "System Administration Utilities"
4ff291
 .SH NAME
4ff291
 ocf-tester \- Part of the Linux-HA project
4ff291
 .SH SYNOPSIS
4ff291
 .B ocf-tester
4ff291
-[\fI-LhvqdX\fR] \fI-n resource_name \fR[\fI-o name=value\fR]\fI* /full/path/to/resource/agent\fR
4ff291
+[\fI-hvqdX\fR] \fI-n resource_name \fR[\fI-o name=value\fR]\fI* /full/path/to/resource/agent\fR
4ff291
 .SH DESCRIPTION
4ff291
 Tool for testing if a cluster resource is OCF compliant
4ff291
 .SH OPTIONS
4ff291
@@ -26,11 +26,6 @@ Name of the resource
4ff291
 \fB\-o\fR name=value
4ff291
 Name and value of any parameters required by the agent
4ff291
 .TP
4ff291
-\fB\-L\fR
4ff291
-Use lrmadmin/lrmd for tests
4ff291
-.PP
4ff291
-Usage: ocf\-tester [\-Lh] \fB\-n\fR resource_name [\-o name=value]* /full/path/to/resource/agent
4ff291
-.TP
4ff291
 \fB\-h\fR
4ff291
 This text
4ff291
 .TP
4ff291
@@ -51,6 +46,3 @@ Name of the resource
4ff291
 .TP
4ff291
 \fB\-o\fR name=value
4ff291
 Name and value of any parameters required by the agent
4ff291
-.TP
4ff291
-\fB\-L\fR
4ff291
-Use lrmadmin/lrmd for tests
4ff291
diff --git a/tools/ocf-tester.in b/tools/ocf-tester.in
4ff291
index 10822a5a06..15b14e51ea 100755
4ff291
--- a/tools/ocf-tester.in
4ff291
+++ b/tools/ocf-tester.in
4ff291
@@ -25,8 +25,6 @@
4ff291
 # Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
4ff291
 #
4ff291
 
4ff291
-LRMD=@libdir@/heartbeat/lrmd
4ff291
-LRMADMIN=@sbindir@/lrmadmin
4ff291
 DATADIR=@datadir@
4ff291
 METADATA_LINT="xmllint --noout --valid -"
4ff291
 
4ff291
@@ -61,7 +59,6 @@ usage() {
4ff291
     echo "  -X       		Turn on RA tracing (expect large output)"
4ff291
     echo "  -n name		Name of the resource"	
4ff291
     echo "  -o name=value		Name and value of any parameters required by the agent"
4ff291
-    echo "  -L			Use lrmadmin/lrmd for tests"
4ff291
     exit $1
4ff291
 }
4ff291
 
4ff291
@@ -104,7 +101,6 @@ while test "$done" = "0"; do
4ff291
 	-o) name=${2%%=*}; value=${2#*=}; 
4ff291
 		lrm_ra_args="$lrm_ra_args $2";
4ff291
 		ra_args="$ra_args OCF_RESKEY_$name='$value'"; shift; shift;;
4ff291
-	-L) use_lrmd=1; shift;;
4ff291
 	-v) verbose=1; shift;;
4ff291
 	-d) export HA_debug=1; shift;;
4ff291
 	-X) export OCF_TRACE_RA=1; verbose=1; shift;;
4ff291
@@ -140,79 +136,6 @@ stopped_rc=7
4ff291
 has_demote=1
4ff291
 has_promote=1
4ff291
 
4ff291
-start_lrmd() {
4ff291
-	lrmd_timeout=0
4ff291
-	lrmd_interval=0
4ff291
-	lrmd_target_rc=EVERYTIME
4ff291
-	lrmd_started=""
4ff291
-	$LRMD -s 2>/dev/null
4ff291
-	rc=$?
4ff291
-	if [ $rc -eq 3 ]; then
4ff291
-		lrmd_started=1
4ff291
-		$LRMD &
4ff291
-		sleep 1
4ff291
-		$LRMD -s 2>/dev/null
4ff291
-	else
4ff291
-		return $rc
4ff291
-	fi
4ff291
-}
4ff291
-add_resource() {
4ff291
-	$LRMADMIN -A $OCF_RESOURCE_INSTANCE \
4ff291
-		ocf \
4ff291
-		`basename $agent` \
4ff291
-		$(basename `dirname $agent`) \
4ff291
-		$lrm_ra_args > /dev/null
4ff291
-}
4ff291
-del_resource() {
4ff291
-	$LRMADMIN -D $OCF_RESOURCE_INSTANCE
4ff291
-}
4ff291
-parse_lrmadmin_output() {
4ff291
-	awk '
4ff291
-BEGIN{ rc=1; }
4ff291
-/Waiting for lrmd to callback.../ { n=1; next; }
4ff291
-n==1 && /----------------operation--------------/ { n++; next; }
4ff291
-n==2 && /return code:/ { rc=$0; sub("return code: *","",rc); next }
4ff291
-n==2 && /---------------------------------------/ {
4ff291
-        n++;
4ff291
-        next;
4ff291
-}
4ff291
-END{
4ff291
-	if( n!=3 ) exit 1;
4ff291
-	else exit rc;
4ff291
-}
4ff291
-'
4ff291
-}
4ff291
-exec_resource() {
4ff291
-	op="$1"
4ff291
-	args="$2"
4ff291
-	$LRMADMIN -E $OCF_RESOURCE_INSTANCE \
4ff291
-		$op $lrmd_timeout $lrmd_interval \
4ff291
-		$lrmd_target_rc \
4ff291
-		$args | parse_lrmadmin_output
4ff291
-}
4ff291
-
4ff291
-if [ "$use_lrmd" = 1 ]; then
4ff291
-	echo "Using lrmd/lrmadmin for all tests"
4ff291
-	start_lrmd || {
4ff291
-		echo "could not start lrmd" >&2
4ff291
-		exit 1
4ff291
-	}
4ff291
-	trap '
4ff291
-		[ "$lrmd_started" = 1 ] && $LRMD -k
4ff291
-	' EXIT
4ff291
-	add_resource || {
4ff291
-		echo "failed to add resource to lrmd" >&2
4ff291
-		exit 1
4ff291
-	}
4ff291
-fi
4ff291
-
4ff291
-lrm_test_command() {
4ff291
-	action="$1"
4ff291
-	msg="$2"
4ff291
-	debug "$msg"
4ff291
-	exec_resource $action "$lrm_ra_args"
4ff291
-}
4ff291
-
4ff291
 test_permissions() {
4ff291
     action=meta-data
4ff291
     debug ${1:-"Testing permissions with uid nobody"}
4ff291
@@ -233,10 +156,6 @@ test_command() {
4ff291
     action=$1; shift
4ff291
     export __OCF_ACTION=$action
4ff291
     msg=${1:-"Testing: $action"}
4ff291
-    if [ "$use_lrmd" = 1 ]; then
4ff291
-    	lrm_test_command $action "$msg"
4ff291
-    	return $?
4ff291
-    fi
4ff291
     #echo Running: "export $ra_args; $agent $action 2>&1 > /dev/null"
4ff291
     if [ $verbose -eq 0 ]; then
4ff291
 	command_output=`$agent $action 2>&1`