Blame SOURCES/0335-iscsi-parse-iscsiroot.sh-only-set-initiator-name-if-.patch

64b87c
From eb87dc91d078ee942ef9c8bbc8e82f4ee4ccf0c6 Mon Sep 17 00:00:00 2001
64b87c
From: Harald Hoyer <harald@redhat.com>
64b87c
Date: Thu, 3 Sep 2015 12:41:06 +0200
64b87c
Subject: [PATCH] iscsi/parse-iscsiroot.sh: only set initiator-name, if not
64b87c
 empty
64b87c
64b87c
---
64b87c
 modules.d/95iscsi/parse-iscsiroot.sh | 14 ++++++++------
64b87c
 1 file changed, 8 insertions(+), 6 deletions(-)
64b87c
64b87c
diff --git a/modules.d/95iscsi/parse-iscsiroot.sh b/modules.d/95iscsi/parse-iscsiroot.sh
1755ca
index 6dd929f3..6aa14f5b 100755
64b87c
--- a/modules.d/95iscsi/parse-iscsiroot.sh
64b87c
+++ b/modules.d/95iscsi/parse-iscsiroot.sh
64b87c
@@ -118,12 +118,14 @@ fi
64b87c
 # If not given on the cmdline and initiator-name available via iBFT
64b87c
 if [ -z $iscsi_initiator ] && [ -f /sys/firmware/ibft/initiator/initiator-name ] && ! [ -f /tmp/iscsi_set_initiator ]; then
64b87c
     iscsi_initiator=$(while read line || [ -n "$line" ]; do echo $line;done < /sys/firmware/ibft/initiator/initiator-name)
64b87c
-    echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
64b87c
-    rm -f /etc/iscsi/initiatorname.iscsi
64b87c
-    mkdir -p /etc/iscsi
64b87c
-    ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
64b87c
-    > /tmp/iscsi_set_initiator
64b87c
-    systemctl try-restart iscsid && sleep 1
64b87c
+    if [ -n "$iscsi_initiator" ]; then
64b87c
+        echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
64b87c
+        rm -f /etc/iscsi/initiatorname.iscsi
64b87c
+        mkdir -p /etc/iscsi
64b87c
+        ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
64b87c
+        > /tmp/iscsi_set_initiator
64b87c
+        systemctl try-restart iscsid && sleep 1
64b87c
+    fi
64b87c
 fi
64b87c
 
64b87c