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