File 0003-IPaddr2-Log-ip-addr-add-options-together.patch of Package resource-agents.23998

From c8afb43012c264f3ee24013a92b2a2f3566db2fd Mon Sep 17 00:00:00 2001
From: Petr Pavlu <petr.pavlu@suse.com>
Date: Tue, 8 Mar 2022 12:35:56 +0100
Subject: [PATCH 3/4] IPaddr2: Log 'ip addr add' options together

Change the log message in add_interface() from
"Adding ... (with <opt1>) (with <opt2>)"
to
"Adding ... (with <opt1> <opt2>)".
---
 heartbeat/IPaddr2 | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2
index e243a642..dca1b6f5 100755
--- a/heartbeat/IPaddr2
+++ b/heartbeat/IPaddr2
@@ -651,7 +651,7 @@ delete_interface () {
 #        Add an interface
 #
 add_interface () {
-	local cmd msg ipaddr netmask broadcast iface label
+	local cmd msg extra_opts ipaddr netmask broadcast iface label
 
 	ipaddr="$1"
 	netmask="$2"
@@ -679,23 +679,24 @@ add_interface () {
 		msg="Adding $FAMILY address $ipaddr/$netmask with broadcast address $broadcast to device $iface"
 	fi
 
+	extra_opts=""
 	if [ "$FAMILY" = "inet6" ] && ocf_is_true "${OCF_RESKEY_nodad}"; then
-		cmd="$cmd nodad"
-		msg="${msg} (with nodad)"
+		extra_opts="$extra_opts nodad"
 	fi
 
 	if ocf_is_true "${OCF_RESKEY_noprefixroute}"; then
-		cmd="$cmd noprefixroute"
-		msg="${msg} (with noprefixroute)"
+		extra_opts="$extra_opts noprefixroute"
 	fi
 
 	if [ ! -z "$label" ]; then
-		cmd="$cmd label $label"
-		msg="${msg} (with label $label)"
+		extra_opts="$extra_opts label $label"
 	fi
 	if [ "$FAMILY" = "inet6" ] ;then
-		cmd="$cmd preferred_lft $OCF_RESKEY_preferred_lft"
-		msg="${msg} (with preferred_lft $OCF_RESKEY_preferred_lft)"
+		extra_opts="$extra_opts preferred_lft $OCF_RESKEY_preferred_lft"
+	fi
+	if [ -n "$extra_opts" ]; then
+		cmd="$cmd$extra_opts"
+		msg="$msg (with$extra_opts)"
 	fi
 
 	ocf_log info "$msg"
-- 
2.26.2

openSUSE Build Service is sponsored by