Fix key error when interface has no inet adddr (fix #20422)

This commit is contained in:
Ahmed Kamal 2015-02-14 18:11:22 +02:00
parent 4267f00dd3
commit 231d4e64ac

View File

@ -739,7 +739,10 @@ def interface_ip(iface):
'''
Return the interface details
'''
return interfaces().get(iface, {}).get('inet', {})[0].get('address', {})
try:
return interfaces().get(iface, {}).get('inet', {})[0].get('address', {})
except KeyError:
return {} # iface has no IP
def subnets():