{"action":"created","issue":{"url":"https://api.github.com/repos/hashicorp/vault-ruby/issues/11","labels_url":"https://api.github.com/repos/hashicorp/vault-ruby/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/vault-ruby/issues/11/comments","events_url":"https://api.github.com/repos/hashicorp/vault-ruby/issues/11/events","html_url":"https://github.com/hashicorp/vault-ruby/issues/11","id":94469362,"number":11,"title":"Vault.logical.write fails when writing to a path that doesn't support reads","user":{"login":"olly","id":630,"avatar_url":"https://avatars.githubusercontent.com/u/630?v=3","gravatar_id":"","url":"https://api.github.com/users/olly","html_url":"https://github.com/olly","followers_url":"https://api.github.com/users/olly/followers","following_url":"https://api.github.com/users/olly/following{/other_user}","gists_url":"https://api.github.com/users/olly/gists{/gist_id}","starred_url":"https://api.github.com/users/olly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olly/subscriptions","organizations_url":"https://api.github.com/users/olly/orgs","repos_url":"https://api.github.com/users/olly/repos","events_url":"https://api.github.com/users/olly/events{/privacy}","received_events_url":"https://api.github.com/users/olly/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/hashicorp/vault-ruby/labels/bug","name":"bug","color":"f7c6c7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-11T12:29:05Z","updated_at":"2015-07-14T18:52:41Z","closed_at":null,"body":"I was trying to programatically setup the postgresql secret backend:\r\n\r\n```ruby\r\nVault.sys.mount('postgresql', 'postgresql')\r\nVault.logical.write('postgresql/config/connection', value: 'postgresql://localhost/vault_database_connection_test?sslmode=disable')\r\n```\r\n\r\nThis raises a `Vault::HTTPError`:\r\n```\r\n/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/vault-0.1.3/lib/vault/client.rb:278:in `error': The Vault server at `http://127.0.0.1:8200' responded with a 500. (Vault::HTTPError)\r\nAny additional information the server supplied is shown below:\r\n\r\n  * unsupported operation\r\n\r\nPlease refer to the documentation for help.\r\n\tfrom /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/vault-0.1.3/lib/vault/client.rb:183:in `block in request'\r\n\tfrom /usr/local/var/rbenv/versions/2.2.0/lib/ruby/2.2.0/net/http.rb:853:in `start'\r\n\tfrom /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/vault-0.1.3/lib/vault/client.rb:173:in `request'\r\n\tfrom /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/vault-0.1.3/lib/vault/client.rb:59:in `get'\r\n\tfrom /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/vault-0.1.3/lib/vault/api/logical.rb:27:in `read'\r\n\tfrom /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/vault-0.1.3/lib/vault/api/logical.rb:48:in `write'\r\n\tfrom test.rb:4:in `<main>'\r\n```\r\n\r\nThis is caused in [`logical.rb`](https://github.com/hashicorp/vault-ruby/blob/e3a42d298240affc0a83faec24cea3ad3e2e7125/lib/vault/api/logical.rb#L48) as it attempts to read from the path after it writes.\r\n\r\nIt's possible to work around it with the following, but I would expect the above to work:\r\n\r\n```ruby\r\n client.put('/v1/vault_database_connection/config/connection', JSON.fast_generate(value: 'postgresql://olly@localhost:5432/vault_database_connection_test?sslmode=disable'))\r\n```"},"comment":{"url":"https://api.github.com/repos/hashicorp/vault-ruby/issues/comments/121339781","html_url":"https://github.com/hashicorp/vault-ruby/issues/11#issuecomment-121339781","issue_url":"https://api.github.com/repos/hashicorp/vault-ruby/issues/11","id":121339781,"user":{"login":"olly","id":630,"avatar_url":"https://avatars.githubusercontent.com/u/630?v=3","gravatar_id":"","url":"https://api.github.com/users/olly","html_url":"https://github.com/olly","followers_url":"https://api.github.com/users/olly/followers","following_url":"https://api.github.com/users/olly/following{/other_user}","gists_url":"https://api.github.com/users/olly/gists{/gist_id}","starred_url":"https://api.github.com/users/olly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olly/subscriptions","organizations_url":"https://api.github.com/users/olly/orgs","repos_url":"https://api.github.com/users/olly/repos","events_url":"https://api.github.com/users/olly/events{/privacy}","received_events_url":"https://api.github.com/users/olly/received_events","type":"User","site_admin":false},"created_at":"2015-07-14T18:52:41Z","updated_at":"2015-07-14T18:52:41Z","body":"I just tested it against master, and #7 hasn't fixed it (it looks like that PR was released in 0.1.13, which IIRC was the version I was using).\r\n\r\nThe issue is that \"postgresql/config/connection\" doesn't have a corresponding \"read\" endpoint. As I see it, the only sensible thing to do is to return `nil`, in this case. The question then is, do we want to try and read a value and return `nil` if it fails. Or not attempt to read at all?\r\n\r\nI'd favour the later I think. Unless I'm missing something, if you've just written the secret, you shouldn't need to read it again immediately."}}