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