mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Fix key error when interface has no inet adddr (fix #20422)
This commit is contained in:
parent
4267f00dd3
commit
231d4e64ac
@ -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():
|
||||
|
Loading…
Reference in New Issue
Block a user