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

Re: [PATCH rhel6-branch] Don't overwrite 70-persistent-net.rules (#597625)



Looks good to me. Thanks Radek.

I suppose, network.copyConfigToPath after network.write in instdata.py
does the copying to /mnt/sysimage/.

On 05/31/2010 01:37 PM, Radek Vykydal wrote:
> I accidentally dropped commit f62ac02d6923230e7cf501d3db24c07f14791e6b

That commit seems to be a "new version" type to me. Did you mean this one?:
0ba6cb516da384e30efdd0dbd70a6c12336fd4f5
Take 70-persistent-net.rules generated at installation (#526322)

> during nm-c-e integration.
> ---
>  network.py |   41 +++++++++++++++++++++--------------------
>  1 files changed, 21 insertions(+), 20 deletions(-)
> 
> diff --git a/network.py b/network.py
> index 8b0d109..531ba9d 100644
> --- a/network.py
> +++ b/network.py
> @@ -653,36 +653,37 @@ class Network:
> 
>          # /etc/udev/rules.d/70-persistent-net.rules
>          rules = "/etc/udev/rules.d/70-persistent-net.rules"
> -        f = open(rules, "w")
> -        f.write("""
> +        if not os.path.isfile(rules):
> +            f = open(rules, "w")
> +            f.write("""
>  # This file was automatically generated by the /lib/udev/write_net_rules
>  # program run by the persistent-net-generator.rules rules file.
>  #
>  # You can modify it, as long as you keep each rule on a single line.
> 
>  """)
> -        for dev in self.netdevices.values():
> -            addr = dev.get("HWADDR")
> -            if not addr:
> -                continue
> -            devname = dev.get("DEVICE")
> -            basename = devname
> -            while basename != "" and basename[-1] in string.digits:
> -                basename = basename[:-1]
> +            for dev in self.netdevices.values():
> +                addr = dev.get("HWADDR")
> +                if not addr:
> +                    continue
> +                devname = dev.get("DEVICE")
> +                basename = devname
> +                while basename != "" and basename[-1] in string.digits:
> +                    basename = basename[:-1]
> 
> -            # rules are case senstive for address. Lame.
> -            addr = addr.lower()
> +                # rules are case senstive for address. Lame.
> +                addr = addr.lower()
> 
> -            s = ""
> -            if len(dev.description) > 0:
> -                s = "# %s (rule written by anaconda)\n" % (dev.description,)
> -            else:
> -                s = "# %s (rule written by anaconda)\n" % (devname,)
> -            s = s + 'SUBSYSTEM==\"net\", ACTION==\"add\", DRIVERS=="?*", ATTR{address}=="%s", ATTR{type}=="1", KERNEL=="%s*", NAME="%s"\n' % (addr, basename, devname,)
> +                s = ""
> +                if len(dev.description) > 0:
> +                    s = "# %s (rule written by anaconda)\n" % (dev.description,)
> +                else:
> +                    s = "# %s (rule written by anaconda)\n" % (devname,)
> +                s = s + 'SUBSYSTEM==\"net\", ACTION==\"add\", DRIVERS=="?*", ATTR{address}=="%s", ATTR{type}=="1", KERNEL=="%s*", NAME="%s"\n' % (addr, basename, devname,)
> 
> -            f.write(s)
> +                f.write(s)
> 
> -        f.close()
> +            f.close()
> 
>      def waitForDevicesActivation(self, devices):
>          waited_devs_props = {}

Steffen

Linux on System z Development

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294



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