network.routes should not raise exception if no interface (#37794)

* network.routes should not raise exception if no interface

* use >= instead of ==
This commit is contained in:
Jorge Schrauwen 2016-11-21 21:25:53 +01:00 committed by Nicole Thomas
parent 628c4a3d27
commit c66b51b9b9

View File

@ -490,7 +490,7 @@ def _netstat_route_sunos():
'gateway': comps[1],
'netmask': '',
'flags': comps[2],
'interface': comps[5]})
'interface': comps[5] if len(comps) >= 6 else ''})
cmd = 'netstat -f inet6 -rn | tail -n+5'
out = __salt__['cmd.run'](cmd, python_shell=True)
for line in out.splitlines():
@ -501,7 +501,7 @@ def _netstat_route_sunos():
'gateway': comps[1],
'netmask': '',
'flags': comps[2],
'interface': comps[5]})
'interface': comps[5] if len(comps) >= 6 else ''})
return ret