kubevirt / client-python

An auto-generated python SDK to interact with KubeVirt resources
Apache License 2.0
30 stars 36 forks source link

APIs with lookup by namespace fail due to improper resource path replacement #53

Closed akurtz-penguin closed 1 year ago

akurtz-penguin commented 2 years ago

For example, list_namespaced_virtual_machine_instance_preset("testns") makes a request to:

2022-08-02 09:49:55,106 DEBUG https://api.example.com.com:6443 "GET /apis/kubevirt.io/v1/namespaces/%7Bnamespace:%5Ba-z0-9%5D%5Ba-z0-9%5C-%5D*%7D/virtualmachineinstancepresets HTTP/1.1" 200 140

when it should be making a request to

2022-08-02 09:45:34,839 DEBUG https://api.example.com:6443 "GET /apis/kubevirt.io/v1/namespaces/testns/virtualmachineinstancepresets HTTP/1.1"

The issue is the resource path replacement:

https://github.com/kubevirt/client-python/blob/master/kubevirt/api_client.py#L121

                resource_path = resource_path.replace(
                    '{%s}' % k, quote(str(v), safe=config.safe_chars_for_path_param))

https://raw.githubusercontent.com/kubevirt/client-python/master/kubevirt/apis/default_api.py return self.api_client.call_api('/apis/kubevirt.io/v1/namespaces/{namespace:[a-z0-9][a-z0-9\-]*}/virtualmachineinstancepresets', 'GET',

{namespace} would be replaced, {namespace:[a-z0-9][a-z0-9-]*} is not.

kubevirt-bot commented 2 years ago

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

/lifecycle stale

akurtz-penguin commented 2 years ago

/remove-lifecycle stale

kubevirt-bot commented 1 year ago

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

/lifecycle stale

kubevirt-bot commented 1 year ago

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

/lifecycle rotten

akurtz-penguin commented 1 year ago

/remove-lifecycle rotten.

kubevirt-bot commented 1 year ago

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten.

/close

kubevirt-bot commented 1 year ago

@kubevirt-bot: Closing this issue.

In response to [this](https://github.com/kubevirt/client-python/issues/53#issuecomment-1492563791): >Rotten issues close after 30d of inactivity. >Reopen the issue with `/reopen`. >Mark the issue as fresh with `/remove-lifecycle rotten`. > >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.