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

fabiand at redhat.com fabiand at redhat.com
Fri Jan 29 10:04:36 UTC 2016


Fabian Deutsch has uploaded a new change for review.

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/79/52879/1

diff --git a/scripts/ovirt-init-functions.sh.in b/scripts/ovirt-init-functions.sh.in
index 96190c1..aaa4f1c 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/...]
@@ -939,10 +940,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/52879
To unsubscribe, visit https://gerrit.ovirt.org/settings

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



More information about the node-patches mailing list