[PATCH 2/3] Do not modify /etc/hosts from setup package (#530343).

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Adding the user-specified hostname to the 127.0.0.1 line is breaking
virt systems, among other things.  I'm not entirely sure we need this
functionality anymore (faking the hostname as 127.0.0.1).

This reverts the changes done in
1aa67d5a2cdacd45f92ba15aa9392ba7191a49c7, but looking at the comments
for #506384, you'll see the same complaints as #530343 has are present.
---
 network.py |   23 -----------------------
 1 files changed, 0 insertions(+), 23 deletions(-)

diff --git a/network.py b/network.py
index 248255a..cb2a8e7 100644
--- a/network.py
+++ b/network.py
@@ -677,29 +677,6 @@ class Network:
             if domainname:
                 self.domains = [domainname]
 
-        # /etc/hosts
-        # update lines for 127.0.0.1 and ::1 with hostname if the file exists
-        if instPath and os.path.isfile(instPath + "/etc/hosts"):
-            of = open(instPath + "/etc/hosts", "r")
-            updatedlines = []
-            update = False
-            for line in of:
-                line = line.strip()
-                if line.startswith('127.0.0.1') or line.startswith('::1'):
-                    if self.hostname not in line.split():
-                        line += " %s" % self.hostname
-                        update = True
-                updatedlines.append(line)
-            of.close()
-
-            if update:
-                nf = open(instPath + "/etc/hosts", "w")
-                upd_comment = "# hostname %s added to /etc/hosts by anaconda\n" % self.hostname
-                nf.write(upd_comment + '\n'.join(updatedlines) + '\n')
-                nf.close()
-                log.info("/etc/hosts updated with hostname %s" % self.hostname) 
-
-
         # /etc/resolv.conf
         if (not instPath) or (not os.path.isfile(instPath + '/etc/resolv.conf')) or flags.livecdInstall:
             if os.path.isfile('/etc/resolv.conf') and instPath != '':
-- 
1.6.2.5

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux