opsmill / infrahub

Infrahub - A new approach to Infrastructure Management
https://opsmill.com/
GNU Affero General Public License v3.0
150 stars 7 forks source link

bug: Get resource mutations ignore size/prefix length #3630

Closed gmazoyer closed 1 month ago

gmazoyer commented 1 month ago

Component

API Server / GraphQL

Current Behavior

Resource manager mutations IPPrefixPoolGetResourceInput and IPAddressPoolGetResourceInput both expose a parameter related to the prefix length to set on the object to allocate.

They use different naming, which is a bit confusion, but those parameters are ignored when executing the mutations. This is due to the mutations code which looks for prefixlen instead of the parameter names, thus always defaulting the value to None.

The prefix length for address is also expected as a string by GraphQL which is wrong.

Expected Behavior

  1. Having the same name for the parameter for both IP address and IP prefix
  2. Allocated nodes should have the proper prefix length

Steps to Reproduce

  1. Start infrahub and load demo schema and data
  2. Try running the mutation above (with a correct ID)
  3. Observe the prefix length will not match what was asked
mutation AllocateIPPrefix {
  IPPrefixPoolGetResource(
    data: {id: "17d7a9d6-92ec-f1d8-2784-179f9720a4b7", size:31}
  ) {
    ok
    node {
      id
    }
  }
}

Additional Information

No response