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

implement "has" operator to check for key existence #104

Open
rhrazdil opened this issue Aug 30, 2022 · 2 comments
Open

implement "has" operator to check for key existence #104

rhrazdil opened this issue Aug 30, 2022 · 2 comments

Comments

@rhrazdil
Copy link
Collaborator

In a scenario where user would like to configure for example all ethernet NICs that are not veth, nmpolicy should
implement has or exists operator.

Currently, the python implementation of nmstatectl outputs type: veth for veth interfaces, but future rust implementation
outputs

type: ethernet
veth:
  peer: name

So for filtering ethernet interfaces that are not veths, we'll need to check for existence of veth key.

@qinqon
Copy link
Member

qinqon commented Aug 30, 2022

Instead of new operator we can create a new "none" literal used to check field existence

interfaces.veth == none

If we go with "exists" we will need to also implement != operator

interfaces.veth != exists

@rhrazdil
Copy link
Collaborator Author

Ah, I assumed that != is alredy implemented. I think using none literal is a good suggestion. I'll go with that

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