bug 6378: Port bug fix for ifaces with no ip address into 2.1.x -- very complicated to do after alexs commit "More file changes" that merged a giant batch of patches

This commit is contained in:
Manuel Amador (Rudd-O) 2010-10-04 14:52:01 -07:00
parent 0b74b3d684
commit 3047ef6a22
1 changed files with 2 additions and 1 deletions

View File

@ -154,7 +154,8 @@ def ifaces():
def ip(iface):
status,lines = commands.getstatusoutput('LANG=C /sbin/ip address show %s'%iface)
assert status == 0
if status != 0: return False
# 7249f168 (Alex Huang 2010-09-09 11:52:12 -0700 175) # used to say: assert status == 0 but it caused a bug in ifaces without IP
lines = [ l for l in lines.splitlines() if l.startswith(' inet ') ]
if not lines: return None
toks = lines[0].split()