mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
correctly cast to int for status.netdevs on Solaris like platforms
This commit is contained in:
parent
b74761b52d
commit
d214e9c776
1 changed files with 6 additions and 2 deletions
|
@ -838,15 +838,19 @@ def netdev():
|
|||
# add data
|
||||
ret[dev] = {}
|
||||
for i in range(len(netstat_ipv4[0])-1):
|
||||
if netstat_ipv4[0][i] == 'Name':
|
||||
continue
|
||||
if netstat_ipv4[0][i] in ['Address', 'Net/Dest']:
|
||||
ret[dev]['IPv4 {field}'.format(field=netstat_ipv4[0][i])] = netstat_ipv4[1][i]
|
||||
else:
|
||||
ret[dev][netstat_ipv4[0][i]] = netstat_ipv4[1][i]
|
||||
ret[dev][netstat_ipv4[0][i]] = int(netstat_ipv4[1][i]) if netstat_ipv4[1][i].isdigit() else netstat_ipv4[1][i]
|
||||
for i in range(len(netstat_ipv6[0])-1):
|
||||
if netstat_ipv6[0][i] == 'Name':
|
||||
continue
|
||||
if netstat_ipv6[0][i] in ['Address', 'Net/Dest']:
|
||||
ret[dev]['IPv6 {field}'.format(field=netstat_ipv6[0][i])] = netstat_ipv6[1][i]
|
||||
else:
|
||||
ret[dev][netstat_ipv6[0][i]] = netstat_ipv6[1][i]
|
||||
ret[dev][netstat_ipv6[0][i]] = int(netstat_ipv6[1][i]) if netstat_ipv6[1][i].isdigit() else netstat_ipv6[1][i]
|
||||
|
||||
return ret
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue