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

Vault.logical.read throws NoMethodError when Vault responds with HTTP 204 (No Content) #241

Open
wfhartford opened this issue Jun 30, 2020 · 1 comment

Comments

@wfhartford
Copy link

When the Vault.logical.read function is called and Vault responds with a HTTP 204 No Content response, a NoMethodError is thrown by the vault client:

/usr/local/bundle/gems/vault-0.14.0/lib/vault/response.rb:49:in `initialize': undefined method `each' for nil:NilClass (NoMethodError)
	from /usr/local/bundle/gems/vault-0.14.0/lib/vault/response.rb:38:in `new'
	from /usr/local/bundle/gems/vault-0.14.0/lib/vault/response.rb:38:in `decode'
	from /usr/local/bundle/gems/vault-0.14.0/lib/vault/api/logical.rb:48:in `read'

In my case, I was requesting the /pki/ca where pki is the path of a newly mounted PKI secret engine whose signing certificate has not been created.

The Logical.read function calls client.get which returns nil when the server responds with 204. This nil value gets passed to Secret.decode from which the NoMethodError is thrown.

@wfhartford
Copy link
Author

The work around I've used is to call client.get directly and check for nil.

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

No branches or pull requests

1 participant