3888c9
From a590dfb3670a68b9eebc3e0ea617c5cf192c51ae Mon Sep 17 00:00:00 2001
3888c9
From: Martin Wilck <mwilck@suse.de>
3888c9
Date: Thu, 4 Apr 2019 15:40:14 +0200
3888c9
Subject: [PATCH] iscsiroot: there's never more than one target per call
3888c9
3888c9
iscsi_target_name is set by iscsi_root, and thus can't have
3888c9
more than one member. This allows us to get rid of one bashism
3888c9
in iscsiroot.sh.
3888c9
---
3888c9
 modules.d/95iscsi/iscsiroot.sh | 11 +++--------
3888c9
 1 file changed, 3 insertions(+), 8 deletions(-)
3888c9
3888c9
diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh
3888c9
index 45db89c1..a334b76e 100755
3888c9
--- a/modules.d/95iscsi/iscsiroot.sh
3888c9
+++ b/modules.d/95iscsi/iscsiroot.sh
3888c9
@@ -213,10 +213,8 @@ handle_netroot()
3888c9
     targets=$(iscsiadm -m discovery -t st -p $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} | sed 's/^.*iqn/iqn/')
3888c9
     [ -z "$targets" ] && echo "Target discovery to $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} failed with status $?" && exit 1
3888c9
 
3888c9
-    for target in $iscsi_target_name; do
3888c9
-        case "$targets" in
3888c9
-        *$target*)
3888c9
-            EXTRA=""
3888c9
+    for target in $targets; do
3888c9
+        if [ "$target" = "$iscsi_target_name" ]; then
3888c9
             if [ -n "$iscsi_iface_name" ]; then
3888c9
                 iscsiadm -m iface -I $iscsi_iface_name --op=new
3888c9
                 EXTRA=" ${iscsi_netdev_name:+--name=iface.net_ifacename --value=$iscsi_netdev_name} "
3888c9
@@ -239,10 +237,7 @@ handle_netroot()
3888c9
             if [ "$netif" != "timeout" ]; then
3888c9
                 $CMD --login
3888c9
             fi
3888c9
-        ;;
3888c9
-        *)
3888c9
-        ;;
3888c9
-        esac
3888c9
+        fi
3888c9
     done
3888c9
 
3888c9
     if [ "$netif" = "timeout" ]; then
3888c9