File 0004-hcnmgr-Avoid-using-xargs-to-process-NM-show-connecti.patch of Package powerpc-utils.20109

From 1cb8bd89d6386c60e75c47d4a4452d3f130d5138 Mon Sep 17 00:00:00 2001
From: Mingming Cao <mmc@linux.vnet.ibm.com>
Date: Fri, 12 Mar 2021 14:18:18 -0800
Subject: [PATCH 4/4] hcnmgr: Avoid using xargs to process NM show connections

References: bsc#1181956 ltc#190722
Upstream: accpeted, expected v1.3.9
Git-commit: 1cb8bd89d6386c60e75c47d4a4452d3f130d5138

When removing HNV bonding connections xargs can fail to process the output of
nmcli show propererly.

Instead of piping into xargs fix this by using a loop to check for all related
bonding connections and remove them explicitly one by one.

Signed-off-by: Mingming Cao <mmc@linux.vnet.ibm.com>
[tyreld: fixed up commit log]
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
---
 scripts/hcnmgr | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/hcnmgr b/scripts/hcnmgr
index d66b5d1c3ea1..30d31e7faef5 100644
--- a/scripts/hcnmgr
+++ b/scripts/hcnmgr
@@ -377,7 +377,10 @@ rmhcn() {
 	fi
 
 	hcnlog INFO "rmhcn: delete bond $BONDNAME and slaves "
-	nmcli -f NAME con show | grep "$BONDNAME" | xargs sudo nmcli con delete
+	for connection in $(nmcli -f NAME con show | grep "$BONDNAME"); do
+		hcnlog INFO "Delete bonding connection $connection"
+		nmcli con delete "$connection"
+	done
 	hcnlog DEBUG "rmhcn: exit"
 	return $E_SUCCESS
 }
-- 
2.26.2

openSUSE Build Service is sponsored by