Re: [PATCH f17-branch 2/2] dracut/parse-kickstart: handle network --device=link (or none)

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

 



On Tue, 2012-03-27 at 21:26 -0700, Brian C. Lane wrote:

> > +        line.append("ip=%s:dhcp" % dev if dev else "ip=dhcp")
> 
> I don't think that's what you meant to do. If dev is None you're going
> to end up with:
> 
> ip=ip=dhcp

Actually, no: the 'if .. else' construct[1] has higher precedence than
anything except 'lambda'[2]. Try it and see:

for dev in ("eth0", "", None):
    str = "ip=%s:dhcp" % dev if dev else "ip=dhcp"
    print str

I did actually test this code before sending it for review - I try to
test everything I send, or clearly mark it as untested otherwise. I
assume that's what everyone does? Do we need to codify that or anything?

-w

[1] Called "Conditional Expressions", introduced in Python 2.5 by PEP308
[2] http://docs.python.org/reference/expressions.html#summary

_______________________________________________
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