python-ifcfg
python-ifcfg copied to clipboard
Downed interfaces still appear in ifcfg
When i launch a command like :
sudo ifconfig eth0 down
and after I run ifcfg.interfaces() in a new python interpreter the eth0 interface still appears. Is it an expected behavior ?
What do you see if you just run ifconfig
from command line after sudo ifconfig eth0 down
?
If i run ifconfig
the interface doesn't show up. But when i run ip address show
the interface does show up but the flags are different from the interfaces that are not down.
In the results returned by ifcfg.interfaces()
if UP is not present in the flag then it's a downed interface.
ifconfig
is the preferred command on Linux when it exists, and ip
is the fallback. So this result is a bit surprising.
The somewhat strange implementation is in src/ifcfg/__init__.py
:
https://github.com/ftao/python-ifcfg/blob/0f26702f9b5e647f63c30fb94817ad3c9132b43e/src/ifcfg/init.py#L23-L30