Add Tenant field to AvailableIP model#56
Open
msollanych-tt wants to merge 5 commits into
Open
Conversation
NetBox requires tenant_id when creating available IPs via the prefixes and IP ranges endpoints. The upstream swagger spec doesn't include this field, so we add it manually. Changes: - Add Tenant int64 field to WritableAvailableIP model - Change IpamPrefixesAvailableIpsCreate params to use WritableAvailableIP - Change IpamIPRangesAvailableIpsCreate params to use WritableAvailableIP Based on upstream master (550476f) which includes render-config endpoint and service parent_object fields. Made-with: Cursor
…d/module_type_id in dcim_*_templates list endpoints The OpenAPI spec this client was generated from uses the legacy `devicetype_id` / `moduletype_id` query parameter names for the dcim_*_templates list endpoints. Modern NetBox (4.4+, possibly earlier) renamed these to `device_type_id` and `module_type_id`, matching the rest of the API. Critically, NetBox **silently ignores** unknown query params on these endpoints rather than rejecting them. So a list call with `?devicetype_id=164` returns the unfiltered global list of templates of that type, not the templates owned by device_type 164. Code paths that use the result for reconciliation (e.g. terraform-provider-netbox nested device_type templates feature) will then attempt to delete templates that are not in their config, mass-corrupting NetBox. Patches all 30 SetQueryParam call sites in 10 files: dcim_console_port_templates_list_parameters.go dcim_console_server_port_templates_list_parameters.go dcim_device_bay_templates_list_parameters.go dcim_front_port_templates_list_parameters.go dcim_interface_templates_list_parameters.go dcim_inventory_item_templates_list_parameters.go dcim_module_bay_templates_list_parameters.go dcim_power_outlet_templates_list_parameters.go dcim_power_port_templates_list_parameters.go dcim_rear_port_templates_list_parameters.go Field types and `WithDevicetypeID` / `WithModuletypeID` Go method names are deliberately left alone — only the wire-format query param strings change. The Go-side API is identical; existing callers stay source-compatible. Verified against NetBox 4.4.10: ?devicetype_id=99999 -> 200, count=66 (silently ignored, returns all) ?device_type_id=99999 -> 400, "Select a valid choice." (correct) Made-with: Cursor
fix: correct ui_visible JSON tag on WritableCustomField (was ui_visib…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
So basically my Netbox has a requirement for the Tenant field when you put in an IP address, and the current version was not setting it correctly; this is an AI slop-coded fix for the problem verified against my fork of terraform-provider-netbox that I'll be releasing in a bit; I don't intend or suggest to take over maintenance or anything like that, just need to get unblocked for some work projects here that use Netbox heavily. I unfortunately don't even speak Go, but hey, it's 2025; be harsh with your criticisms and I'll be happy to go feed them back into the AI for ya and spit out something better.
Hopefully this stuff can get rolled upstream and then I'll archive my forks; though I might have some more fixes for you in the future. Thanks for the work on this BTW!