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

Compatiblity to read IPRoute attribute #1223

Open
ffourcot opened this issue Dec 20, 2024 · 3 comments
Open

Compatiblity to read IPRoute attribute #1223

ffourcot opened this issue Dec 20, 2024 · 3 comments

Comments

@ffourcot
Copy link
Collaborator

Hello,

We used to read IPRoute attributes to check if some options are enabled on it, like this:

from pyroute2 import IPRoute

ipr = IPRoute(all_ns=True)
if ipr.all_ns is True:
   do_something()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In [4], line 1
----> 1 ipr.all_ns is True
[...]
File pyroute2/pyroute2/netlink/core.py:339, in AsyncCoreSocket.__getattr__(self, attr)
    337 elif attr in ('_sendto', '_recv', '_recv_into'):
    338     return getattr(self.socket, attr.lstrip("_"))
--> 339 raise AttributeError(attr)

AttributeError: all_ns

How can we update our code to check this now?

@svinota
Copy link
Owner

svinota commented Dec 20, 2024

You can check this attribute, as well as some others, in the status dictionary:

print(ipr.status)

But currently this particular all_ns functionality might be broken in the master branch. If so, let me know. And beside of that I'll add a functional test for that, it's missing now.

Pls be aware that the core is being rewritten, so some more issues might happen the nearest weeks.

@ffourcot
Copy link
Collaborator Author

I understood that current master branch is "experimental", it's fine for me. I just tried to run some of our tests suites with it, to report (and perhaps contribute to solve) emerging bugs.

Please consider all our reports as low priority, it's only to track it. So far, it looks promising.

@svinota
Copy link
Owner

svinota commented Dec 20, 2024

I hope to keep the master branch less experimental :)

But the CI covers not all the functionality yet, thus compatibility issues.

The first priority now is to make the current master as functional as 0.8.1, though eventual API differences might happen.

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