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

feature: add field 'parent_id' to Location Resource & Data Source #548

Merged
merged 5 commits into from
Feb 16, 2024

Conversation

GennadySpb
Copy link
Contributor

Hello there!

We actively use Location nesting. And I really miss the ability to read and write the “parent_id” value in a DCIM model resource Location.

This PR is about the same as in #508.

PTAL.

@fbreckle
Copy link
Collaborator

Can you add a test that UNSETs the parent_id? I assume it will fail because of reasons similar to the linked issue. I will then fix it in fbreckle/go-netbox, if necessary.

@GennadySpb
Copy link
Contributor Author

Can you add a test that UNSETs the parent_id? I assume it will fail because of reasons similar to the linked issue. I will then fix it in fbreckle/go-netbox, if necessary.

You're right, the update doesn't work.
I'm trying to update go-netbox locally for testing (use the x-omitempty: false option), but it failed on generate goal when running:

make: *** [generate] Error 137

What could be wrong?

p.s. Docker at macOS on ARM CPU.

@fbreckle
Copy link
Collaborator

Googling the error gives me mostly "out of memory" results. I will generate a branch with the change for you.

@fbreckle
Copy link
Collaborator

Change is at https://github.com/fbreckle/go-netbox/tree/feature/parent_id

You should be able to use go get github.com/fbreckle/go-netbox@3b369d7c46cfb41981a33275e1a1ae841248d68d now

@GennadySpb
Copy link
Contributor Author

Did a quick check. Looks like it works :)

@fbreckle
Copy link
Collaborator

fbreckle commented Feb 14, 2024

Can you add the test that unsets a parent id as well? Else LGTM

Just add one more step to one of the tests where the parent id is unset and then check if its actually unset or 0 or whatever.

@GennadySpb
Copy link
Contributor Author

Can you add the test that unsets a parent id as well? Else LGTM
Check Acceptance test TestAccNetboxLocationsDataSource_sublocations, it contains two configs:

  1. create hierarchy of Locations
  2. remove parent_id

@fbreckle fbreckle force-pushed the parent4location branch 2 times, most recently from c1e0e74 to 53e0120 Compare February 16, 2024 13:22
@fbreckle fbreckle merged commit d781a16 into e-breuninger:master Feb 16, 2024
8 checks passed
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

Successfully merging this pull request may close these issues.

2 participants