[PATCH 1/7] Clean up ifcfg file handling.
Radek Vykydal
rvykydal at redhat.com
Mon Sep 16 07:05:21 UTC 2013
On 09/13/2013 05:30 PM, Samantha N. Bueno wrote:
> On Fri, Sep 13, 2013 at 03:32:15PM +0200, Radek Vykydal wrote:
>> +
>> +def find_ifcfg_file_of_device(devname, root_path=""):
>> + ifcfg_path = None
>> + try:
>> + hwaddr = nm.nm_device_hwaddress(devname)
>> + except nm.PropertyNotFoundError:
>> + hwaddr = None
>> + if hwaddr:
>> + hwaddr_check = lambda mac: mac.upper() == hwaddr.upper()
>> + ifcfg_path = find_ifcfg_file([("HWADDR", hwaddr_check)])
>> + if not ifcfg_path:
>> + ifcfg_path = find_ifcfg_file([("DEVICE", devname)])
>> + return ifcfg_path
>> +
> It doesn't look like root_path is ever used in this function, can it
> just be removed from the signature completely (and following that, from
> every instance where the function gets called)?
I should pass the root_path to find_ifcfg_file (it is actually used eg
for disableNMForStorageDevices where we work with ifcfg files
on target system ('/mnt/sysimage'). Thanks for the catch.
Radek
More information about the anaconda-patches
mailing list