summaryrefslogtreecommitdiffstats
path: root/network.py
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2008-12-16 18:18:15 -1000
committerDavid Cantrell <dcantrell@redhat.com>2008-12-17 14:57:00 -1000
commitcd1101e32b051c568097d8fe33cbe35081ce936d (patch)
tree635b5d0520dc0f49b8547f21e7db58ef443758ed /network.py
parent50167c5adb78f7d7ad60b2255e6859fbeb1c41ad (diff)
downloadanaconda-cd1101e32b051c568097d8fe33cbe35081ce936d.tar.gz
anaconda-cd1101e32b051c568097d8fe33cbe35081ce936d.tar.xz
anaconda-cd1101e32b051c568097d8fe33cbe35081ce936d.zip
Only write the short hostname to the localhost line (#474086)
Do not write the FQDN to the localhost line, only write the short hostname if it's something other than 'localhost'. Only write the FQDN line to /etc/hosts if we have an IP address for the host. Without this patch, users performing media installs who enter an FQDN in the hostname field end up with their FQDN == 127.0.0.1, which messes up things, such as sendmail. Writing the short name is what we really want here. [rawhide]
Diffstat (limited to 'network.py')
-rw-r--r--network.py11
1 files changed, 3 insertions, 8 deletions
diff --git a/network.py b/network.py
index adde7cbcd..a2624cf76 100644
--- a/network.py
+++ b/network.py
@@ -677,14 +677,9 @@ class Network:
domainname = None
localline = "localhost.localdomain localhost"
- if not ip or not fqdn:
- # There is no ip or no fqdn, tie it to 127.0.0.1.
- if fqdn:
- # add fqdn to 127.0.0.1
- localline += " " + fqdn
- if hostname and hostname != "localhost":
- # add short hostname to 127.0.0.1
- localline += " " + hostname
+ if not ip and (hostname and hostname != "localhost"):
+ # add short hostname to 127.0.0.1
+ localline += " " + hostname
f.write("# Do not remove the following line, or various programs\n")
f.write("# that require network functionality will fail.\n")