From b6913f66b6c9e9ea81fd0832405c170876bc993a Mon Sep 17 00:00:00 2001
From: Steffen Maier <maier@linux.ibm.com>
Date: Wed, 26 Jul 2023 12:42:03 +0200
Subject: [PATCH 17/23] refactor(ifcfg): delete code duplication using
iface_get_subchannels()
Signed-off-by: Steffen Maier <maier@linux.ibm.com>
---
modules.d/45ifcfg/write-ifcfg.sh | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh
index 5550cce3..4ca96e98 100755
--- a/modules.d/45ifcfg/write-ifcfg.sh
+++ b/modules.d/45ifcfg/write-ifcfg.sh
@@ -31,19 +31,13 @@ print_s390() {
local NETTYPE
local CONFIG_LINE
local i
- local channel
local OLD_IFS
_netif="$1"
# if we find ccw channel, then use those, instead of
# of the MAC
- SUBCHANNELS=$({
- for i in /sys/class/net/"$_netif"/device/cdev[0-9]*; do
- [ -e "$i" ] || continue
- channel=$(readlink -f "$i")
- printf '%s' "${channel##*/},"
- done
- })
+ # [iface_get_subchannels() from /lib/net-lib.sh sourced at top of this file]
+ SUBCHANNELS=$(iface_get_subchannels "$_netif")
[ -n "$SUBCHANNELS" ] || return 1
SUBCHANNELS=${SUBCHANNELS%,}
--
2.42.0