vmware-archive / kubecfg

A tool for managing complex enterprise Kubernetes environments as code.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Import libsonnet file on windows is not working

PapaMufflon opened this issue · comments

Having a simple libsonnet file:

{
    test: "test"
}

and an simple jsonnet file:

local foo = import "test.libsonnet";

foo

When I do kubecfg.exe show -o yaml test.jsonnet, I get

ERROR Error reading test.jsonnet: RUNTIME ERROR: Could not get candidate URLs for when importing test.libsonnet (import dir is file://C:%5Csrc%5Ctest.jsonnet)
        file://C:%5Csrc%5Ctest.jsonnet:1:13-36       thunk <foo> from <$>
        file://C:%5Csrc%5Ctest.jsonnet:3:1-4 $
        During evaluation

Thanks for the report!

The bug is somewhere in https://github.com/ksonnet/kubecfg/blob/6b6a76d1ef6aab0e6a496ac86cea18e6dbfb171b/utils/importer.go#L145 or maybe in the initial construction of the current-directory file URL (https://github.com/ksonnet/kubecfg/blob/master/utils/acquire.go#L159)

I have no idea how file:// URLs are meant to be treated on windows ;)
How does the drive letter get encoded? Which way do the slashes go?

@anguslees I don't know golang, but file://C/src/test.jsonnet should be correct. So basically remove the ':' after the C :)