summaryrefslogtreecommitdiffstats
path: root/todo.py
diff options
context:
space:
mode:
authorMatt Wilson <msw@redhat.com>2000-01-27 18:57:33 +0000
committerMatt Wilson <msw@redhat.com>2000-01-27 18:57:33 +0000
commitc03427037defff3f3748c7d60a8d15e266d268b5 (patch)
treedcae854ef95979488bb987dcedbf34e0aef9be36 /todo.py
parent5347430341312164cf431f29755d2f65cda445fa (diff)
downloadanaconda-c03427037defff3f3748c7d60a8d15e266d268b5.tar.gz
anaconda-c03427037defff3f3748c7d60a8d15e266d268b5.tar.xz
anaconda-c03427037defff3f3748c7d60a8d15e266d268b5.zip
hostname stuff not committed in tree
Diffstat (limited to 'todo.py')
-rw-r--r--todo.py26
1 files changed, 25 insertions, 1 deletions
diff --git a/todo.py b/todo.py
index 59f587e66..c4c8a393c 100644
--- a/todo.py
+++ b/todo.py
@@ -520,8 +520,32 @@ class ToDo:
# /etc/hosts
f = open (self.instPath + "/etc/hosts", "w")
localline = "127.0.0.1\t\t"
+
+
+ self.log ("self.network.hostname = %s", self.network.hostname)
+
+ # if user assigned a hostname other than localhost.localdomain then
+ # search devices and see if this hostname has a static IP
+ # assignment. If not put it in loopback line to make X happy
+ #
if self.network.hostname != "localhost.localdomain":
- localline = localline + self.network.hostname + " "
+ foundhostname = 0
+ self.log ("Looking for dev to match system hostname")
+ for dev in self.network.netdevices.values ():
+ ip = dev.get ("ipaddr")
+ hostname = dev.hostname
+ self.log ("Checking device %s: ip = %s hostname = %s",
+ dev.get ("device"), ip, hostname)
+ if hostname and ip and hostname == self.network.hostname:
+ foundhostname = 1
+ self.log ("Device %s matched", dev.get ("device"))
+ break
+
+ self.log ("foundhostname is %d", foundhostname)
+
+ if not foundhostname:
+ localline = localline + self.network.hostname + " "
+
localline = localline + "localhost.localdomain localhost\n"
f.write (localline)
for dev in self.network.netdevices.values ():