client/rhel/rhn-client-tools/src/up2date_client/hardware.py | 14 +++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
New commits: commit 54051af0f52cccac8823495e8e3b27029532f97a Author: Milan Zazrivec mzazrivec@redhat.com Date: Fri Dec 7 17:12:38 2012 +0100
882174 - read the hostname from /etc/hostname if needed
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/hardware.py b/client/rhel/rhn-client-tools/src/up2date_client/hardware.py index 41856e4..97ba6b6 100644 --- a/client/rhel/rhn-client-tools/src/up2date_client/hardware.py +++ b/client/rhel/rhn-client-tools/src/up2date_client/hardware.py @@ -449,11 +449,19 @@ def findHostByRoute(): s.close() continue s.close() - + + # Override hostname with the value from /etc/hostname + if os.path.isfile("/etc/hostname") and os.access("/etc/hostname", os.R_OK): + hostnameinfo = open("/etc/hostname", "r").readlines() + + for info in hostnameinfo: + if not len(info): + continue + hostname = info.strip() + # Override hostname with the one in /etc/sysconfig/network # for bz# 457953 - - if os.path.isfile("/etc/sysconfig/network") and os.access("/etc/sysconfig/network", os.R_OK): + elif os.path.isfile("/etc/sysconfig/network") and os.access("/etc/sysconfig/network", os.R_OK): networkinfo = open("/etc/sysconfig/network", "r").readlines() for info in networkinfo: