[PATCH] Fix a logic problem with network file write outs. (480769)

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

 



We're trying to cover two scenarios with a single if statement:
  The scenario pre-install where we're writing out files to the
  tmpfs in order to bring up the network.

  The scenario post-install where we're writing out files to the
  installed system for network on reboot.

We're also trying to preserve any files that may be in the installed
filesystem post-install time.  The logic should now handle this.
---
 network.py |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/network.py b/network.py
index 0d0e2b0..af6d858 100644
--- a/network.py
+++ b/network.py
@@ -622,7 +622,7 @@ class Network:
                     log.warning("unable to copy %s to target system" % (dhclientconf,))
 
         # /etc/sysconfig/network
-        if (not instPath) and (not os.path.isfile(destnetwork)):
+        if (not instPath) or (not os.path.isfile(destnetwork)):
             newnetwork = "%s.new" % (destnetwork,)
 
             f = open(newnetwork, "w")
@@ -646,7 +646,7 @@ class Network:
 
         # /etc/hosts
         domainname = None
-        if (not instPath) and (not os.path.isfile(instPath + "/etc/hosts")):
+        if (not instPath) or (not os.path.isfile(instPath + "/etc/hosts")):
             f = open(instPath + "/etc/hosts", "w")
 
             log.info("self.hostname = %s", self.hostname)
@@ -700,7 +700,7 @@ class Network:
                 self.domains = [domainname]
 
         # /etc/resolv.conf
-        if (not instPath) and (not os.path.isfile(instPath + '/etc/resolv.conf')):
+        if (not instPath) or (not os.path.isfile(instPath + '/etc/resolv.conf')):
             if os.path.isfile('/etc/resolv.conf') and instPath != '':
                 destresolv = "%s/etc/resolv.conf" % (instPath,)
                 shutil.copy('/etc/resolv.conf', destresolv)
@@ -721,7 +721,7 @@ class Network:
 
         # /etc/udev/rules.d/70-persistent-net.rules
         rules = instPath + "/etc/udev/rules.d/70-persistent-net.rules"
-        if (not instPath) and (not os.path.isfile(rules)):
+        if (not instPath) or (not os.path.isfile(rules)):
             if not os.path.isdir("%s/etc/udev/rules.d" %(instPath,)):
                 iutil.mkdirChain("%s/etc/udev/rules.d" %(instPath,))
 
-- 
1.6.0.6

_______________________________________________
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