Closed ljonsson closed 6 years ago
ljonsson@op> python
>>> import ifcfg
>>> interfaces
{}
>>>
ljonsson@op> sudo apt-get install net-tools
ljonsson@op> python
>>> import ifcfg
>>> for i, j in ifcfg.interfaces().items():
... print i
...
enp2s0
lo
tun0
I believe the ip
command is tried before ifconfig. So new distros should work fine, there should be no need for net-tools.
But even if ifcfg returns no interfaces, the agent should still run the speed test, just with much less metadata. If not, that's a separate bug.
What version of ifcfg? Should be able to find it with
import ifcfg
print(ifcfg.__version__)
Or
pip freeze
0.16 which is the latest I think. I see it does have something in there about running ip on newer systems but for some reason it didn't work. I'll try it again.
Related ticket: https://github.com/ftao/python-ifcfg/issues/30
I hope 0.17 fixes this for you, otherwise please feel free to open up another PR and we'll do another release!
Thanks @ljonsson and @benjaoming for all your hard work on this. Looks good to me based on some quick local test. @ljonsson can we close this?
On newer linux distro releases where the old style network config commands such as ifconfig, netstat and route have been abandoned in favor of the ip command, the ifcfg.interfaces() call will fail to identify available interfaces.
One workaround is to require the net-tools package to be installed.