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

GraphQL: Filter devices by status #170

Closed
sirtux opened this issue Mar 18, 2021 · 4 comments
Closed

GraphQL: Filter devices by status #170

sirtux opened this issue Mar 18, 2021 · 4 comments
Labels
status: help wanted Extra attention is needed type: bug Something isn't working as expected
Milestone

Comments

@sirtux
Copy link
Contributor

sirtux commented Mar 18, 2021

Environment

  • Python version: 3.8.5
  • Nautobot version: v1.0.0b2

Steps to Reproduce

Run the following GraphQL-Query:
{ devices(status: "Active") { name status { name } } }

Expected Behavior

I get a result set containing only the device with status "Active" or nothing because "Active" might be a nonexisting status.

Observed Behavior

I get a result set containing all devices

@dgarros
Copy link
Contributor

dgarros commented Mar 18, 2021

This issue is similar to #58, it's a known issue we need to fix

Also it would work as expected if you change "active" to "Active" (slug vs Name)

@sirtux
Copy link
Contributor Author

sirtux commented Mar 18, 2021

Yes, that seems to be the same issue, after some analysis it seems to "fail open" if a filter value is not existing.
I tried that just with a tag: If I search for a tag "foo", and it's not existing -> All devices are returned. If that tag exists, but is not assigned to any device-> empty result.

Seems to be a very easy to make error on the user side and a very unexpected behaviour.

@jathanism jathanism added status: current type: bug Something isn't working as expected labels Mar 18, 2021
@jathanism jathanism added this to the v1.0.0 milestone Mar 18, 2021
@jathanism jathanism added the status: help wanted Extra attention is needed label Mar 18, 2021
@jathanism
Copy link
Contributor

Thanks for the report @sirtux and I tend to agree that this is unexpected behavior. I'd rather filters fail closed and not open, and we also need to try to make the filtering on field values a little more intuitive if we can.

@glennmatthews
Copy link
Contributor

Fixed by #209.

Release v1.0.0 automation moved this from To do to Done Mar 31, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: help wanted Extra attention is needed type: bug Something isn't working as expected
Projects
No open projects
Development

No branches or pull requests

4 participants