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
Fix netbox url with string concat #49943
Conversation
If this patch we would need to be sure that there is no trailing slash for the base_url. |
@sieben What would be the suggestion in handling this? (I do not have a ton of coding experience) Documentation? |
@heathdbrown if |
Did a test on our netbox setup and API calls work with any number of slashes (tested with 1-6 out of curiosity) between the domain part and the actual path. A // in the path itself fails with a 404. Examples:
not working: |
@heathdbrown Could you please rebase this so we can get it merged |
48186b4
to
134cd50
Compare
@gundalow I rebased and I believe this is ready now. |
@Anthony25 @FragmentedPacket @nikkytub @pilou- @sieben could we please get a final review on this? |
@heathdbrown This PR contains |
d04761f
to
837af24
Compare
Sorry about this. Just reviewing it, might be a little cleaner way.
|
@FragmentedPacket that fails as the self.api_endpoint above the if is the first assignment. After commenting it out the plugin fails. |
@heathdbrown Did you change the if statement to look at the self.get_option? |
@FragmentedPacket well that was embarrassing. Thanks for the patience. I have included the complete suggestion. |
Imho, there is no need for the
|
@winem updated to your suggestion and removed the if logic. |
Looks good to me! |
@heathdbrown Hey i'm in the same boat as you lol Looks good to me as well |
@sieben Do you mind looking this over and approving? 2.8 RC stuff starts the 14th of March |
LGTM |
@Anthony25 What do you think about it? |
LGTM as well |
rebuild_merge |
SUMMARY
Fixes #46705
ISSUE TYPE
COMPONENT NAME
ADDITIONAL INFORMATION
The fix in #47655 made the problem worse.
The issue was with how urljoin() removes paths from the configuration.
The way the netbox.py is written the api urls are joined but they all have /api and when merged with /netbox overwrites to /api only which is a missing URL and causes 404s.
Fixing this would mean adjusting /api URL fragments to api OR adjusting the netbox.py to not use urljoin() and use string concat.