Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic when dashboard folder is undefined #180

Closed
tenstad opened this issue Oct 19, 2021 · 0 comments · Fixed by #183
Closed

Panic when dashboard folder is undefined #180

tenstad opened this issue Oct 19, 2021 · 0 comments · Fixed by #183

Comments

@tenstad
Copy link
Contributor

tenstad commented Oct 19, 2021

Error

panic: interface conversion: interface {} is nil, not string
goroutine 1 [running]:
github.com/grafana/grizzly/pkg/grizzly.(*Resource).GetMetadata(...)
	/app/pkg/grizzly/providers.go:72
github.com/grafana/grizzly/pkg/grafana.postDashboard(0xc000a6c4e0, 0x18e1200, 0xc00007fae0)
	/app/pkg/grafana/dashboards.go:99 +0xc99
github.com/grafana/grizzly/pkg/grafana.(*DashboardHandler).Add(0x2c02968, 0xc000a6c4e0, 0x0, 0x0)
	/app/pkg/grafana/dashboard-handler.go:117 +0x2b
github.com/grafana/grizzly/pkg/grizzly.Apply(0xc000391820, 0x4, 0x4, 0xc000185ce0, 0x3)
	/app/pkg/grizzly/workflow.go:240 +0x49e
main.applyCmd.func1(0xc000280960, 0xc0003837b0, 0x1, 0x1, 0x0, 0x0)
	/app/cmd/grr/workflow.go:122 +0x111
github.com/go-clix/cli.(*Command).execute(0xc000280960, 0xc000383790, 0x1, 0x1, 0xc000280960, 0xc000383790)
	/go/pkg/mod/github.com/go-clix/cli@v0.2.0/command.go:118 +0x34e
github.com/go-clix/cli.(*Command).Execute(0xc0003b55e0, 0xc0008bff28, 0xa)
	/go/pkg/mod/github.com/go-clix/cli@v0.2.0/command.go:76 +0x105
main.main()
	/app/cmd/grr/main.go:44 +0x26b

How to reproduce

In the examples/ folder, modify grr.jsonnet as shown below, and run grr apply grr.jsonnet.

local dashboard = import 'dashboard-simple.libsonnet';
local grr = import 'grizzly/grizzly.libsonnet';

{
  dashboards: [
    grr.dashboard.new('prod-overview', dashboard),
  ],
}

Suggested solution

It would be nice if the general folder is used as a default when metadata.folder is undefined.
If, however, a folder should be required, I would expect an error saying so, not a stack trace.

Personally, I strongly prefer making general the default, rather than metadata.folder beeing a required field. 😄

@tenstad tenstad changed the title Panic when dashboard folder is not specified Panic when dashboard folder is undefined Oct 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant