Skip to content

GraphQL: NOT-Filter (here for tenants_list) not honored for group(_id) and results includes the filtered group #18163

Closed
@dxks

Description

@dxks

Deployment Type

Self-hosted

Triage priority

N/A

NetBox Version

v4.1.7

Python Version

3.12

Steps to Reproduce

All verified on demo.netbox.dev (so assumption is that Tenant-Group Customers exists)

  1. Create a new Tenant-Group (i.e. Partners)
  2. Create a new Tenant and make it a member of Partners

Fire the folling graphql query:

query MyQuery {
  tenant_list(filters:{NOT:{group:"customers"}}) {
    id
    name
    group {
      id
      name
      slug
    }
  }
}

Expected Behavior

Getting a list of all Tenants that are not member of the group Customers:

{
  "data": {
    "tenant_list": [
      {
        "id": "15",
        "name": "NetBoxLabs",
        "group": {
          "id": "2",
          "name": "Partners",
          "slug": "partners"
        }
      }
    ]
  }
}

Observed Behavior

Getting a list of all Tenants that are member of the group Customers:

{
  "data": {
    "tenant_list": [
      {
        "id": "7",
        "name": "Cyberdyne Systems",
        "group": {
          "id": "1",
          "name": "Customers",
          "slug": "customers"
        }
      },
      {
        "id": "5",
        "name": "Dunder-Mifflin, Inc.",
        "group": {
          "id": "1",
          "name": "Customers",
          "slug": "customers"
        }
      },
      {
        "id": "1",
        "name": "Initech",
        "group": {
          "id": "1",
          "name": "Customers",
          "slug": "customers"
        }
      },
      {
        "id": "10",
        "name": "Jimbob's Banking & Trust",
        "group": {
          "id": "1",
          "name": "Customers",
          "slug": "customers"
        }
      },
      {
        "id": "13",
        "name": "NC State University",
        "group": {
          "id": "1",
          "name": "Customers",
          "slug": "customers"
        }
      },
      {
        "id": "9",
        "name": "Nakatomi Corportation",
        "group": {
          "id": "1",
          "name": "Customers",
          "slug": "customers"
        }
      },
      {
        "id": "3",
        "name": "Pied Piper",
        "group": {
          "id": "1",
          "name": "Customers",
          "slug": "customers"
        }
      },
      {
        "id": "4",
        "name": "Stark Industries",
        "group": {
          "id": "1",
          "name": "Customers",
          "slug": "customers"
        }
      },
      {
        "id": "2",
        "name": "Strickland Propane",
        "group": {
          "id": "1",
          "name": "Customers",
          "slug": "customers"
        }
      },
      {
        "id": "8",
        "name": "Umbrella Corporation",
        "group": {
          "id": "1",
          "name": "Customers",
          "slug": "customers"
        }
      },
      {
        "id": "6",
        "name": "Wayne Enterprises",
        "group": {
          "id": "1",
          "name": "Customers",
          "slug": "customers"
        }
      }
    ]
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: duplicateThis issue has already been raisedtype: bugA confirmed report of unexpected behavior in the application

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions