Blob Blame History Raw
From eb87dc91d078ee942ef9c8bbc8e82f4ee4ccf0c6 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 3 Sep 2015 12:41:06 +0200
Subject: [PATCH] iscsi/parse-iscsiroot.sh: only set initiator-name, if not
 empty

---
 modules.d/95iscsi/parse-iscsiroot.sh | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/modules.d/95iscsi/parse-iscsiroot.sh b/modules.d/95iscsi/parse-iscsiroot.sh
index 6dd929f3..6aa14f5b 100755
--- a/modules.d/95iscsi/parse-iscsiroot.sh
+++ b/modules.d/95iscsi/parse-iscsiroot.sh
@@ -118,12 +118,14 @@ fi
 # If not given on the cmdline and initiator-name available via iBFT
 if [ -z $iscsi_initiator ] && [ -f /sys/firmware/ibft/initiator/initiator-name ] && ! [ -f /tmp/iscsi_set_initiator ]; then
     iscsi_initiator=$(while read line || [ -n "$line" ]; do echo $line;done < /sys/firmware/ibft/initiator/initiator-name)
-    echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
-    rm -f /etc/iscsi/initiatorname.iscsi
-    mkdir -p /etc/iscsi
-    ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
-    > /tmp/iscsi_set_initiator
-    systemctl try-restart iscsid && sleep 1
+    if [ -n "$iscsi_initiator" ]; then
+        echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
+        rm -f /etc/iscsi/initiatorname.iscsi
+        mkdir -p /etc/iscsi
+        ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
+        > /tmp/iscsi_set_initiator
+        systemctl try-restart iscsid && sleep 1
+    fi
 fi