Reputation: 3
Apologies for the dumb question, but I'd like to write variables to vault dynamically. I can't figure out the syntax for it. Maybe it's not possible. I'm basically trying to get this to work:
vault_client.write('secret/foo/%s' path, '%s=%s' % (key, value))
.
When trying to run this, I get this error:
strconv.ParseInt: parsing "key=value": invalid syntax
hvac wants something like this:
vault_client.write('secret/foo/path', key="value")
Is there a way to do this in python?
Thanks!
Upvotes: 0
Views: 1574
Reputation: 135
Create a dictionary first. Pass the dictionary as the **kwargs to the function.
For example:
secrets = {'a': 'foo', 'b': 'bar', 'c': 'baz'}
path = 'secret/path'
client.write(path, **secrets)
Upvotes: 2