Vinod JV
Vinod JV

Reputation: 13

No such file or directory error while running jsonnet with grafonnet-lib

I have cloned grafonnet-lib from https://github.com/grafana/grafonnet-lib link and created a sample jsonnet file to convert it to json that grafana can read. But when I run the command "jsonnet -J /Data/Perf_Tool/grafonnet-lib/ sample.jsonnet" I get "Opening input file: sample.jsonnet: No such file or directory" Error. I have cloned grafonnet-lib project into /Data/Perf_Tool/grafonnet-lib/ directory and sample.jsonnet file is created on the same directory.

root@hostname:/Data/Perf_Tool/grafonnet-lib# jsonnet -J /Data/Perf_Tool/grafonnet-lib/ sample.jsonnet 
Opening input file: sample.jsonnet: No such file or directory

Content of sample.jsonnet

local grafana = import 'grafonnet/grafana.libsonnet';
local dashboard = grafana.dashboard;
local text = grafana.text;
dashboard.new('My Cool Dashboard')
.addPanel(
 text.new(
 title="Oh Hi",
 content="Welcome to my dashboard.",
 ),
 gridPos={x: 0, y: 0, w: 24, h: 10},
)

Please let me know what I am missing.

Upvotes: 1

Views: 1857

Answers (1)

Kashish Garg
Kashish Garg

Reputation: 36

I think you have to provide the full path of the jsonnet file like this:

jsonnet -J /Data/Perf_Tool/grafonnet-lib/ /Data/Perf_Tool/sample.jsonnet

Upvotes: 2

Related Questions