Skip to content
This repository has been archived by the owner on Dec 1, 2018. It is now read-only.

Error in updating ReplicationController on Windows #96

Open
iijimakazuyuki opened this issue Nov 17, 2016 · 0 comments
Open

Error in updating ReplicationController on Windows #96

iijimakazuyuki opened this issue Nov 17, 2016 · 0 comments

Comments

@iijimakazuyuki
Copy link

I'm using pykube v0.13.0 on Windows, but I can't update ReplicationController.

>>> import pykube
>>> api = pykube.HTTPClient(pykube.KubeConfig.from_file("C:\\Users\\kazuyuki\\.kube\\config"))
>>> rc = pykube.ReplicationController.objects(api).get_by_name("myapp")
>>> rc.update()
Traceback (most recent call last):
  File "C:\Program Files\Python35\lib\site-packages\pykube\http.py", line 99, in raise_for_status
    resp.raise_for_status()
  File "C:\Program Files\Python35\lib\site-packages\requests\models.py", line 884, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://192.168.99.100:8443/api/v1/namespaces/default/replicationcontrollers%5Cmyapp

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\Python35\lib\site-packages\pykube\objects.py", line 90, in update
    self.api.raise_for_status(r)
  File "C:\Program Files\Python35\lib\site-packages\pykube\http.py", line 106, in raise_for_status
    raise HTTPError(payload["message"])
pykube.exceptions.HTTPError: the server could not find the requested resource
>>>

The url: https://192.168.99.100:8443/api/v1/namespaces/default/replicationcontrollers%5Cmyapp is invalid. This url is generated in objects.py,

54            kw["url"] = op.normpath(op.join(self.endpoint, self.name, operation))

It seems that this line can't work in Windows, where os.path uses \ (%5C in the url) instead of /.
I think this line should be

54            kw["url"] = "/".join([self.endpoint, self.name, operation])
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant