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

can't support windows platform? #124

Open
xiaoxiaoye opened this issue Mar 30, 2017 · 0 comments
Open

can't support windows platform? #124

xiaoxiaoye opened this issue Mar 30, 2017 · 0 comments

Comments

@xiaoxiaoye
Copy link

when i operate Node,i find that i can create,but cann't delete.so i analyse the url,i add some code(print(kw["url"])) to see what the url like. in the window,the url is wrong,it like "http://127.0.01/nodes\centos1"
the reason is that in windows platform os.path.join function will concat path use "\",not "/"

def api_kwargs(self, **kwargs):
        kw = {}
        # Construct url for api request
        obj_list = kwargs.pop("obj_list", False)
        if obj_list:
            kw["url"] = self.endpoint
        else:
            operation = kwargs.pop("operation", "")
            kw["url"] = op.normpath(op.join(self.endpoint, self.name, operation))
        print(kw["url"])

useage:

api = pykube.HTTPClient(pykube.KubeConfig.from_file("./kubeconfig"))
obj_node = {
    "apiVersion": "v1",
    "kind": "Node",
    "metadata": {
        "name": "centos1",
        "labels": {
            "hostname": "centos1"
        }
    }
}
#pykube.Node(api,obj_node).create()
pykube.Node(api,obj_node).delete()

output:

nodes\centos1
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