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

Ignore trailing slashes for server url #375

Closed
wants to merge 1 commit into from

Conversation

bacher09
Copy link

kubectl by default ignores trailing slashes for server url, but python client isn't. For example if you have server URL like this: https://kubernetes.example:8443/ (with trailing slash), kubectl will work, but python client will fail with kubernetes.client.rest.ApiException: (404).

I think it's nice to have consistent behavior across all clients.

@k8s-ci-robot
Copy link
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://github.com/kubernetes/kubernetes/wiki/CLA-FAQ to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Oct 28, 2017
@@ -144,7 +144,8 @@ def __call_api(self, resource_path, method,
body = self.sanitize_for_serialization(body)

# request url
url = self.configuration.host + resource_path
# ignore trailing slashes in base url
url = self.configuration.host.rstrip('/') + resource_path
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if we should modify this file. It's generated by swagger-codegen (see the preamble of this file). @karlbunch suggested different solution (#388) - to fix the value when configuration object is created. How does it look?

Copy link
Author

Choose a reason for hiding this comment

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

Haven't seen that notice. I thought about fixing this in configuration handling code too, but then rejected that idea. This approach isn't solving issue completely, since there is possibility that user will create configuration object manually (in python code).

@bacher09 bacher09 closed this Nov 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants