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

Crash when vault secret is not found #200

Closed
hairyhenderson opened this issue Aug 31, 2017 · 0 comments
Closed

Crash when vault secret is not found #200

hairyhenderson opened this issue Aug 31, 2017 · 0 comments
Assignees
Labels

Comments

@hairyhenderson
Copy link
Owner

This is a regression in v2.0.0.

When attempting to reference a nonexistent secret, gomplate panics now instead of giving an error.

Old behaviour (v1.10.0)

$ gomplate-1.10 -d vault=vault:///secret/path/to/secret -i '{{ ds "vault" "mysecret" }}'
2017/08/31 15:50:34 Couldn't read datasource 'vault': Unexpected HTTP status 404 on Read from /secret/path/to/secret/mysecret: {"errors":[]}

New (buggy) behaviour (v2.0.0)

$ gomplate -d vault=vault:///secret/path/to/secret -i '{{ ds "vault" "mysecret" }}'
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x17297d1]

goroutine 1 [running]:
text/template.errRecover(0xc420159aa0)
	/usr/local/Cellar/go/1.8.3/libexec/src/text/template/exec.go:140 +0x1ec
panic(0x187e0a0, 0x1ebd620)
	/usr/local/Cellar/go/1.8.3/libexec/src/runtime/panic.go:489 +0x2cf
github.com/hairyhenderson/gomplate/vault.(*Vault).Read(0xc420110010, 0xc4204a4f00, 0x3e, 0x19a7eb6, 0x1, 0x7fff5fbff589, 0x19, 0xc4204a4f00)
	/Users/dee/gocode/src/github.com/hairyhenderson/gomplate/vault/vault.go:53 +0xe1
github.com/hairyhenderson/gomplate/data.readVault(0xc4202c9420, 0xc4202c6aa0, 0x1, 0x1, 0xc420197eb0, 0xc4202c1f01, 0x1e, 0xc420158e18, 0x105a174)
	/Users/dee/gocode/src/github.com/hairyhenderson/gomplate/data/datasource.go:368 +0x399
github.com/hairyhenderson/gomplate/data.(*Data).ReadSource(0xc4202c6800, 0xc4202c9420, 0xc4202c6aa0, 0x1, 0x1, 0x1, 0x320194b40, 0x1, 0x28, 0x38)
	/Users/dee/gocode/src/github.com/hairyhenderson/gomplate/data/datasource.go:256 +0x19a
github.com/hairyhenderson/gomplate/data.(*Data).Datasource(0xc4202c6800, 0x7fff5fbff581, 0x5, 0xc4202c6aa0, 0x1, 0x1, 0xc420158ff8, 0x100fe8c)
	/Users/dee/gocode/src/github.com/hairyhenderson/gomplate/data/datasource.go:205 +0xc3
github.com/hairyhenderson/gomplate/data.(*Data).Datasource-fm(0x7fff5fbff581, 0x5, 0xc4202c6aa0, 0x1, 0x1, 0x0, 0x0)
	/Users/dee/gocode/src/github.com/hairyhenderson/gomplate/funcs/data.go:22 +0x5c
reflect.Value.call(0x1852080, 0xc4202c6830, 0x13, 0x19a886c, 0x4, 0xc4202bfc20, 0x2, 0x2, 0xc420159890, 0x10e72b2, ...)
	/usr/local/Cellar/go/1.8.3/libexec/src/reflect/value.go:434 +0x91f
reflect.Value.Call(0x1852080, 0xc4202c6830, 0x13, 0xc4202bfc20, 0x2, 0x2, 0x1e8d900, 0xc420264e40, 0x17fc760)
	/usr/local/Cellar/go/1.8.3/libexec/src/reflect/value.go:302 +0xa4
text/template.(*state).evalCall(0xc420159a20, 0x185dcc0, 0x1eebae8, 0x16, 0x1852080, 0xc4202c6830, 0x13, 0x1e8d540, 0xc4202bfb60, 0x7fff5fbff57d, ...)
	/usr/local/Cellar/go/1.8.3/libexec/src/text/template/exec.go:668 +0x51f
text/template.(*state).evalFunction(0xc420159a20, 0x185dcc0, 0x1eebae8, 0x16, 0xc4202bfb90, 0x1e8d540, 0xc4202bfb60, 0xc420264e80, 0x3, 0x4, ...)
	/usr/local/Cellar/go/1.8.3/libexec/src/text/template/exec.go:536 +0x18e
text/template.(*state).evalCommand(0xc420159a20, 0x185dcc0, 0x1eebae8, 0x16, 0xc4202bfb60, 0x0, 0x0, 0x0, 0xc42001e600, 0x7fff5fbff57a, ...)
	/usr/local/Cellar/go/1.8.3/libexec/src/text/template/exec.go:433 +0x6cd
text/template.(*state).evalPipeline(0xc420159a20, 0x185dcc0, 0x1eebae8, 0x16, 0xc42027e230, 0x100eb02, 0xc4202bfbf0, 0x30)
	/usr/local/Cellar/go/1.8.3/libexec/src/text/template/exec.go:406 +0xf2
text/template.(*state).walk(0xc420159a20, 0x185dcc0, 0x1eebae8, 0x16, 0x1e8d3c0, 0xc4202bfbc0)
	/usr/local/Cellar/go/1.8.3/libexec/src/text/template/exec.go:232 +0x55a
text/template.(*state).walk(0xc420159a20, 0x185dcc0, 0x1eebae8, 0x16, 0x1e8d720, 0xc4202bfb30)
	/usr/local/Cellar/go/1.8.3/libexec/src/text/template/exec.go:240 +0x139
text/template.(*Template).execute(0xc420264d80, 0x1e85d80, 0xc42000c018, 0x185dcc0, 0x1eebae8, 0x0, 0x0)
	/usr/local/Cellar/go/1.8.3/libexec/src/text/template/exec.go:195 +0x20a
text/template.(*Template).Execute(0xc420264d80, 0x1e85d80, 0xc42000c018, 0x185dcc0, 0x1eebae8, 0x0, 0xc4201142d0)
	/usr/local/Cellar/go/1.8.3/libexec/src/text/template/exec.go:178 +0x53
main.(*Gomplate).RunTemplate(0xc4202bfa40, 0x7fff5fbff57a, 0x2c, 0x1e85d80, 0xc42000c018)
	/Users/dee/gocode/src/github.com/hairyhenderson/gomplate/gomplate.go:30 +0x23e
main.renderTemplate(0xc4202bfa40, 0x7fff5fbff57a, 0x2c, 0x19a7eb4, 0x1, 0x0, 0x0)
	/Users/dee/gocode/src/github.com/hairyhenderson/gomplate/gomplate.go:66 +0xc1
main.processInputFiles(0x7fff5fbff57a, 0x2c, 0xc4202c6730, 0x1, 0x1, 0xc4202c6770, 0x1, 0x1, 0xc4202bfa40, 0xc4201f01e0, ...)
	/Users/dee/gocode/src/github.com/hairyhenderson/gomplate/process.go:23 +0x12f
main.runTemplate(0x1eccc00, 0x0, 0x0)
	/Users/dee/gocode/src/github.com/hairyhenderson/gomplate/gomplate.go:55 +0x22d
main.newGomplateCmd.func1(0xc4201ec6c0, 0xc420264d00, 0x0, 0x4, 0x0, 0x0)
	/Users/dee/gocode/src/github.com/hairyhenderson/gomplate/main.go:69 +0x7e
github.com/hairyhenderson/gomplate/vendor/github.com/spf13/cobra.(*Command).execute(0xc4201ec6c0, 0xc42000e240, 0x4, 0x4, 0xc4201ec6c0, 0xc42000e240)
	/Users/dee/gocode/src/github.com/hairyhenderson/gomplate/vendor/github.com/spf13/cobra/command.go:649 +0x457
github.com/hairyhenderson/gomplate/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc4201ec6c0, 0x2, 0x19a80e4, 0x2)
	/Users/dee/gocode/src/github.com/hairyhenderson/gomplate/vendor/github.com/spf13/cobra/command.go:728 +0x339
github.com/hairyhenderson/gomplate/vendor/github.com/spf13/cobra.(*Command).Execute(0xc4201ec6c0, 0xc420159f78, 0x0)
	/Users/dee/gocode/src/github.com/hairyhenderson/gomplate/vendor/github.com/spf13/cobra/command.go:687 +0x2b
main.main()
	/Users/dee/gocode/src/github.com/hairyhenderson/gomplate/main.go:96 +0x46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant