Re: [PATCH] Copy /etc/dhclient-DEV.conf file to target system (#476364)

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

 



Chris Lumens wrote:
>> @@ -614,6 +612,12 @@ class Network:
>>                  destkey = "%s/keys-%s" % (netscripts, device,)
>>                  shutil.move(newkey, destkey)
>>  
>> +            # /etc/dhclient-DEVICE.conf
>> +            dhclientconf = '/etc/dhclient-' + device + '.conf'
>> +            if os.path.isfile(dhclientconf):
>> +                destdhclientconf = '%s%s' % (instPath, dhclientconf,)
>> +                shutil.copy(dhclientconf, destdhclientconf)
>> +
>>          # /etc/sysconfig/network
>>          if not os.path.isfile(destnetwork):
>>              newnetwork = "%s.new" % (destnetwork,)
> 
> I know how much we hate catching exceptions, but perhaps you want to
> try...except around shutil.copy?
> 
> Otherwise, looks fine.

That sounds reasonable.  There are other shutil commands in network.py,
so maybe they should get try/except wrappers too (in another patch).
Here's an update:

Copy /etc/dhclient-DEV.conf file to target system (#476364)

The vendor-class setting gets written to this file during installation,
but we need to copy the file to the target system to make sure it's
present on reboot.  Previously, we wrote this to the ifcfg file for
_something_ that read it, but it doesn't look like anything reads it
from this location anymore (or ever).

[rawhide]
---
 network.py  |   11 +++++++++--
 packages.py |    3 ++-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/network.py b/network.py
index b5ecad4..adde7cb 100644
--- a/network.py
+++ b/network.py
@@ -576,8 +576,6 @@ class Network:
             if (bootproto == 'dhcp' and self.hostname and
                 self.overrideDHCPhostname):
                 f.write("DHCP_HOSTNAME=%s\n" %(self.hostname,))
-            if dev.get('DHCPCLASS'):
-                f.write("DHCP_CLASSID=%s\n" % dev.get('dhcpclass'))

             if dev.get('MTU') and dev.get('MTU') != 0:
                 f.write("MTU=%s\n" % dev.get('MTU'))
@@ -614,6 +612,15 @@ class Network:
                 destkey = "%s/keys-%s" % (netscripts, device,)
                 shutil.move(newkey, destkey)

+            # /etc/dhclient-DEVICE.conf
+            dhclientconf = '/etc/dhclient-' + device + '.conf'
+            if os.path.isfile(dhclientconf):
+                destdhclientconf = '%s%s' % (instPath, dhclientconf,)
+                try:
+                    shutil.copy(dhclientconf, destdhclientconf)
+                except:
+                    log.warning("unable to copy %s to target system" %
(dhclientconf,))
+
         # /etc/sysconfig/network
         if not os.path.isfile(destnetwork):
             newnetwork = "%s.new" % (destnetwork,)
diff --git a/packages.py b/packages.py
index c141c92..cfc6ba2 100644
--- a/packages.py
+++ b/packages.py
@@ -231,7 +231,8 @@ def setFileCons(anaconda):
                  "/etc/mdadm.conf", "/etc/hosts", "/etc/sysconfig/network",
                  "/etc/udev/rules.d/70-persistent-net.rules",
                  "/root/install.log", "/root/install.log.syslog",
-                 "/etc/shadow", "/etc/shadow-", "/etc/gshadow"]
+                 "/etc/shadow", "/etc/shadow-", "/etc/gshadow"] + \
+                glob.glob('/etc/dhclient-*.conf')

         vgs = []
         for entry in anaconda.id.partitions.requests:
-- 
1.6.0.3


-- 
David Cantrell <dcantrell@xxxxxxxxxx>
Red Hat / Honolulu, HI

_______________________________________________
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