Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downed interfaces still appear in ifcfg #65

Open
dupouyleo opened this issue Sep 20, 2021 · 3 comments
Open

Downed interfaces still appear in ifcfg #65

dupouyleo opened this issue Sep 20, 2021 · 3 comments

Comments

@dupouyleo
Copy link

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 ?

@benjaoming
Copy link
Collaborator

What do you see if you just run ifconfig from command line after sudo ifconfig eth0 down?

@dupouyleo
Copy link
Author

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.

@benjaoming
Copy link
Collaborator

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:

if distro == 'Linux':
Parser = parser.LinuxParser
if not os.path.exists(Parser.get_command().split(' ')[0]):
Parser = parser.UnixIPParser
if not os.path.exists(Parser.get_command().split(' ')[0]):
Log.warning("Neither `ifconfig` (`%s`) nor `ip` (`%s`) commands are available, listing network interfaces is likely to fail",
parser.LinuxParser.get_command(),
parser.UnixIPParser.get_command())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants