mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
ipaddr() again returns only the first address, like it did before 0.10.2.
This commit is contained in:
parent
cb709d47fe
commit
076e421ac0
@ -10,24 +10,21 @@ def ipaddr(interface=None):
|
|||||||
out = None
|
out = None
|
||||||
|
|
||||||
if interface:
|
if interface:
|
||||||
data = iflist.get(interface)
|
data = iflist.get(interface) or dict()
|
||||||
if data.get('inet'):
|
if data.get('inet'):
|
||||||
if not out:
|
return data.get('inet')[0]['address']
|
||||||
out = list()
|
|
||||||
out += data.get('inet')
|
|
||||||
if data.get('inet6'):
|
if data.get('inet6'):
|
||||||
if not out:
|
return data.get('inet6')[0]['address']
|
||||||
out = list()
|
|
||||||
out += data.get('inet6')
|
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
out = dict()
|
||||||
for iface, data in iflist.items():
|
for iface, data in iflist.items():
|
||||||
if data.get('inet'):
|
if data.get('inet'):
|
||||||
if not out[iface]: out[iface] = list()
|
out[iface] = data.get('inet')[0]['address']
|
||||||
out[iface] += data.get('inet')
|
continue
|
||||||
if data.get('inet6'):
|
if data.get('inet6'):
|
||||||
if not out[iface]: out[iface] = list()
|
out[iface] = data.get('inet6')[0]['address']
|
||||||
out[iface] += data.get('inet6')
|
continue
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user