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

Change Record._endpoint_from_url() path parsing to ignore host:port #323

Merged

Conversation

markkuleinio
Copy link
Contributor

@markkuleinio markkuleinio commented Jan 2, 2021

This PR changes the logic in Record._endpoint_from_url(): with this change it does not matter what's in the host:port part of the URL as we always check the path of Api.base_url, and if it contains some extra leading directories, those extra directories will be removed from url before parsing the app and name.

There are two sides in this:

  1. This enables the path parsing to work even if the host:port is for some reason different in the NetBox-returned URLs and in the pynetbox user-supplied Api.base_url.
  2. This also masks out some reverse proxy configuration errors like in API .update() fails when API host is in the format "http://ipaddress". Endpoint API URL has missing characters #322 (but that was the original behaviour before Fixes #304: Change Record._endpoint_from_url() URL parsing to support other paths for NetBox than root #308 introduced in pynetbox 5.1.1).

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.

👍 Thanks! Assuming we can skip normalization now.

@zachmoody zachmoody merged commit e91d12f into netbox-community:master Jan 4, 2021
@markkuleinio markkuleinio deleted the change-path-parsing branch January 6, 2021 06:27
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