Skip to content

Conversation

@markkuleinio
Copy link
Contributor

@markkuleinio markkuleinio commented Dec 15, 2020

This is to support NetBox API base URLs with one or more directories. In those cases the previous code picked incorrect parts from the URL.

Fixes #304.

This is to support NetBox API base URLs with one or more directories.
@zachmoody
Copy link
Contributor

Ha, was just about to respond to you in the issue saying I hoped to make some time next week to work on the laundry list of issues that have piled up. You beat me to this one :)

Only concern with this approach is the paths that don't conform to what we're expecting like /ipam/prefixes/:id/available-ips/. I'm just spit-balling here, but wonder if we anchored the index on /api/ if we could get more predictable results. 🤔

Adding a test for that and the directory URLs in test_endpoint_from_url would be great too.

@markkuleinio
Copy link
Contributor Author

Would it be safe to first remove self.api.base_url from url and then get the app and endpoint after that?

Copy link
Contributor

@zachmoody zachmoody left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff, thanks as always @markkuleinio.

@zachmoody zachmoody merged commit 5173efd into netbox-community:master Dec 15, 2020
@markkuleinio markkuleinio changed the title Fixes #304: Change Record._endpoint_from_url() to count URL fields from the end Fixes #304: Change Record._endpoint_from_url() URL parsing to support other paths for NetBox than root Jan 2, 2021
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.

Unable to use .save() on tenant

2 participants