File 1739.patch of Package resource-agents.27878

From 73fc66db3e184446e14fd38273056dae3b59a571 Mon Sep 17 00:00:00 2001
From: Aleksei Burlakov <alex_burlakov@gmx.de>
Date: Tue, 1 Feb 2022 13:10:49 +0100
Subject: [PATCH] ocf-shellfuncs: Parametrise the log destinarion by
 OCF_RESKEY_trace_dir

The OCF_TRACE_FILE takes the precedence. If it's not defined,
the OCF_RESKEY_trace_dir is used. Otherwise the log is stored by default
in $HA_VARLIB/trace_ra/<type>/
---
 heartbeat/README            | 4 +++-
 heartbeat/ocf-shellfuncs.in | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/heartbeat/README b/heartbeat/README
index aaaff3a9c5..604295685d 100644
--- a/heartbeat/README
+++ b/heartbeat/README
@@ -24,7 +24,9 @@ language, use the appropriate extension.
 RA tracing
 
 RA tracing may be turned on by setting OCF_TRACE_RA. The trace
-output will be saved to OCF_TRACE_FILE, if set, or by default to
+output will be saved to OCF_TRACE_FILE, if set. If not,
+then the trace would be saved to the OCF_RESKEY_trace_dir.
+If it's also not defined, the log will be saved by default to
 
   $HA_VARLIB/trace_ra/<type>/<id>.<action>.<timestamp>
 
diff --git a/heartbeat/ocf-shellfuncs.in b/heartbeat/ocf-shellfuncs.in
index 1e83676a7b..2956d12644 100644
--- a/heartbeat/ocf-shellfuncs.in
+++ b/heartbeat/ocf-shellfuncs.in
@@ -962,7 +962,7 @@ ocf_default_trace_dest() {
 	if [ -n "$OCF_RESOURCE_TYPE" -a \
 			-n "$OCF_RESOURCE_INSTANCE" -a -n "$__OCF_ACTION" ]; then
 		local ts=`date +%F.%T`
-		__OCF_TRC_DEST=$HA_VARLIB/trace_ra/${OCF_RESOURCE_TYPE}/${OCF_RESOURCE_INSTANCE}.${__OCF_ACTION}.$ts
+		__OCF_TRC_DEST=${OCF_RESKEY_trace_dir}/${OCF_RESOURCE_TYPE}/${OCF_RESOURCE_INSTANCE}.${__OCF_ACTION}.$ts
 		__OCF_TRC_MANAGE="1"
 	fi
 }
@@ -1039,6 +1039,7 @@ ocf_attribute_target() {
 __ocf_set_defaults "$@"
 
 : ${OCF_TRACE_RA:=$OCF_RESKEY_trace_ra}
+: ${OCF_RESKEY_trace_dir:="$HA_VARLIB/trace_ra"}
 ocf_is_true "$OCF_TRACE_RA" && ocf_start_trace
 
 # pacemaker sets HA_use_logd, some others use HA_LOGD :/
openSUSE Build Service is sponsored by