[node-patches] Change in ovirt-node[ovirt-3.6]: init: Fix the HOSTNAME check

rbarry at redhat.com rbarry at redhat.com
Tue Mar 29 19:51:21 UTC 2016


Hello Fabian Deutsch,

I'd like you to do a code review.  Please visit

    https://gerrit.ovirt.org/55429

to review the following change.

Change subject: init: Fix the HOSTNAME check
......................................................................

init: Fix the HOSTNAME check

HOSTNAME is checkd initially in the init script when the hostname arge
is read from the cmdline.
This breaks the HOSTNAME check further down, when it is read from the
sysconfig/network file.
The fix is to make the variale local before perfoming the check, if it's
local then it will only have the value from the sourced sysconfig/network
file, and not from further up.

Change-Id: Icac879a8c1f3e2269aa42c6e7c4268d82e4f03e3
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1254580
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M scripts/ovirt-init-functions.sh.in
1 file changed, 12 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/29/55429/1

diff --git a/scripts/ovirt-init-functions.sh.in b/scripts/ovirt-init-functions.sh.in
index ee9f877..2fab5b1 100644
--- a/scripts/ovirt-init-functions.sh.in
+++ b/scripts/ovirt-init-functions.sh.in
@@ -211,6 +211,7 @@
 
 _start_ovirt_early () {
     touch $VAR_SUBSYS_OVIRT_EARLY
+
     # oVirt boot parameters
     #   BOOTIF=link|eth*|<MAC> (appended by pxelinux)
     #   storage_init=[usb|scsi[:serial#]|/dev/...]
@@ -940,10 +941,17 @@
         mount_crypt_swap
     fi
     if [ -f /etc/sysconfig/network ]; then
-        . /etc/sysconfig/network
-        if [ -n "$HOSTNAME" ]; then
-            hostname $HOSTNAME
-        fi
+        cond_set_hostname() {
+            # HOSTNAME is set uo further up in this script
+            # we need to make it local to make the check correct
+            # Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1254580
+            local HOSTNAME
+            . /etc/sysconfig/network
+            if [ -n "$HOSTNAME" ]; then
+                hostname $HOSTNAME
+            fi
+        }
+        cond_set_hostname
     fi
     if [ -f /etc/hostname ]; then
         if [ -n "$(cat /etc/hostname)" ]; then


-- 
To view, visit https://gerrit.ovirt.org/55429
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icac879a8c1f3e2269aa42c6e7c4268d82e4f03e3
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Ryan Barry <rbarry at redhat.com>
Gerrit-Reviewer: Fabian Deutsch <fabiand at redhat.com>



More information about the node-patches mailing list