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

[bug] improve safety of policy strategy parsing #98

Closed
jrasell opened this issue Apr 21, 2020 · 0 comments · Fixed by #114
Closed

[bug] improve safety of policy strategy parsing #98

jrasell opened this issue Apr 21, 2020 · 0 comments · Fixed by #114
Assignees
Milestone

Comments

@jrasell
Copy link
Member

jrasell commented Apr 21, 2020

The strategy block of a scaling policy is opaque to Nomad and therefore does not go through validation during job registration. It is the responsibility of the Autoscaler to parse the policy object safely without panics.

Currently the strategy parsing makes some assumptions about the objects underlying types, including that the operator always includes the name parameter within the strategy block. This is a false assumption, and can result a panic when this param is excluded.

panic: interface conversion: interface {} is nil, not string

goroutine 47 [running]:
github.com/hashicorp/nomad-autoscaler/policystorage.parseStrategy(0x16df8e0, 0xc0003c81a0, 0x180e209)
	/Users/jrasell/go/src/github.com/hashicorp/nomad-autoscaler/policystorage/nomad.go:128 +0x31d
github.com/hashicorp/nomad-autoscaler/policystorage.(*Nomad).Get(0xc000692008, 0xc0002d2180, 0x24, 0x194b700, 0xc00000e048, 0x0)
	/Users/jrasell/go/src/github.com/hashicorp/nomad-autoscaler/policystorage/nomad.go:60 +0x308
github.com/hashicorp/nomad-autoscaler/agent.(*Agent).Run.func1(0xc0007143a0, 0x195bea0, 0xc000134480, 0xc000692008, 0x1966320, 0xc0005640f0, 0xc000256570, 0xc0002d2180, 0x24)
	/Users/jrasell/go/src/github.com/hashicorp/nomad-autoscaler/agent/agent.go:84 +0xa6
created by github.com/hashicorp/nomad-autoscaler/agent.(*Agent).Run
	/Users/jrasell/go/src/github.com/hashicorp/nomad-autoscaler/agent/agent.go:78 +0x60f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant