voxpupuli / puppet-vault_lookup

Apache License 2.0
26 stars 42 forks source link

Fix field lookup code. #70

Closed dpavlotzky closed 1 year ago

dpavlotzky commented 1 year ago

Pull Request (PR) description

Removes superfluous ['data'].

This Pull Request (PR) fixes the following issues

Fixes #69

BobSF67 commented 1 year ago

For kv 2, I don't think that second ['data'] was superfluous. At least it was working fine for my kv 2 stuff.

BobSF67 commented 1 year ago

For kv 2, I don't think that second ['data'] was superfluous. At least it was working fine for my kv 2 stuff.

My company had a highly customized version of this module (switched back to Forge version), but this was the bit we had for kv 1 versus kv 2:

      jsondata = if path.include? '/data/'
                   JSON.parse(secret_response.body)['data']['data']
                 else
                   JSON.parse(secret_response.body)['data']
                 end
      data = if key_field.nil? || key_field == ''
               jsondata
             else
               jsondata[key_field]
             end
dpavlotzky commented 1 year ago

Ah, I see, I am not retrieving secrets from a Key/Value secret engine, but from a Active Directory secret engine... Sorry about the noise.