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

kv2 create_or_update_secret response.json() fails #385

Open
TerryHowe opened this issue Jan 31, 2019 · 4 comments · May be fixed by #898
Open

kv2 create_or_update_secret response.json() fails #385

TerryHowe opened this issue Jan 31, 2019 · 4 comments · May be fixed by #898
Labels
kv Key/Value (KV) secrets engine

Comments

@TerryHowe
Copy link
Contributor

https://github.com/hvac/hvac/blob/develop/hvac/api/secrets_engines/kv_v2.py#L124

Blows up because the server returns and empty body and 204s me. It would be nice if a response wasn't required on update.

@jeffwecan jeffwecan added this to the 0.7.3 milestone Jan 31, 2019
@jeffwecan jeffwecan added this to Needs triage in Bug / Feature Request Triage via automation Jan 31, 2019
@jeffwecan jeffwecan added the kv Key/Value (KV) secrets engine label Jan 31, 2019
@jeffwecan
Copy link
Member

So you're seeing exceptions thrown upon a 204 response during updates in particular? I've run into the same issue on occasion and I want to say it only manifests with certain versions of Vault... In any case, I'll be sure to take a look and add any appropriate regression test cases before we cut the next hvac release. 👍

@TerryHowe TerryHowe changed the title kv2 create_or_update_secret response.json() failse kv2 create_or_update_secret response.json() fails Jan 31, 2019
@jeffwecan jeffwecan modified the milestones: 0.8.0, 0.8.1 Mar 29, 2019
@TerryHowe
Copy link
Contributor Author

I'm using basic docker vault btw

    "backend": {
        "file": {
            "path": "/vault/file"
        }
    },
    "listener": {
        "tcp": {
            "address": "0.0.0.0:${PORT}",
            "tls_disable": 1
        }
    },
    "default_lease_ttl": "168h",
    "max_lease_ttl": "720h",
    "disable_mlock": true
}

@jeffwecan jeffwecan modified the milestones: 0.8.3, 0.8.4 May 18, 2019
@jeffwecan jeffwecan modified the milestones: 0.9.1, 0.9.2 May 25, 2019
@jeffwecan jeffwecan removed this from the 0.9.2 milestone Jun 8, 2019
@ba1dr
Copy link

ba1dr commented Jul 30, 2019

I have the same issue with vault (1.1.3) installed from Docker.

The code below executes and value is set. Reading returns correct value.

client.secrets.kv.v2.create_or_update_secret(
    path='kv/test2', mount_point='kv/',
    secret={'value': 18})

Output from requests (I've added print before json parsing):

code: 204
headers: {'Cache-Control': 'no-store', 'Content-Type': 'application/json', 'Date': 'Tue, 30 Jul 2019 14:53:16 GMT'}
text: ""

hvac==0.9.5.

docker-compose.yml:

version: '2'
services:
    myvault:
        image: vault
        container_name: myvault
        ports:
          - "8200:8200"
        volumes:
          - /usr/local/lib/vault/data:/vault/data:rw
          - /usr/local/etc/vault:/vault/config:rw
        cap_add:
          - IPC_LOCK
        command: vault server -config=/vault/config/config.json

config.json:

{
  "listener":  {
    "tcp":  {
      "address":  "0.0.0.0:8200",
      "tls_disable":  "true"
    }
  },
  "storage" :{
        "file" : {
            "path" : "/vault/data"
        }
  },
  "default_lease_ttl": "168h",
  "max_lease_ttl": "0h",
  "api_addr": "http:https://0.0.0.0:8200"
}

@Lucas-C
Copy link

Lucas-C commented Mar 11, 2020

I think the issue with deserializing JSON upon 204 HTTP codes should be solved by #537

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kv Key/Value (KV) secrets engine
Projects
4 participants