[PATCH 2/5] ksnet_to_dracut: handle empty attributes
Will Woods
wwoods at redhat.com
Wed Aug 29 18:07:14 UTC 2012
They might be None, they might be "", they might be missing altogether.
Consider all three possibilities.
---
dracut/parse-kickstart | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dracut/parse-kickstart b/dracut/parse-kickstart
index 8d488d3..5a4826d 100755
--- a/dracut/parse-kickstart
+++ b/dracut/parse-kickstart
@@ -194,7 +194,7 @@ def ksnet_to_dracut(args, lineno, net, bootdev=False):
if is_mac(net.device): # this is a MAC - find the interface name
mac = net.device
net.device = find_devname(mac)
- if net.device is None: # iface not active - pick a name for it
+ if not net.device: # iface not active - pick a name for it
net.device = "ksdev0" # we only get called once, so this is OK
line.append("ifname=%s:%s" % (net.device, mac.lower()))
@@ -207,7 +207,7 @@ def ksnet_to_dracut(args, lineno, net, bootdev=False):
log.error("'%s': --bootproto=query is deprecated", " ".join(args))
elif net.bootProto == BOOTPROTO_STATIC:
req = ("gateway", "netmask", "nameserver", "ip")
- missing = ", ".join("--%s" % i for i in req if not hasattr(net, i))
+ missing = ", ".join("--%s" % i for i in req if not getattr(net, i, ""))
if missing:
log.warn("line %u: network missing %s", lineno, missing)
else:
--
1.7.11.4
More information about the anaconda-patches
mailing list