Add path suffix options

This commit is contained in:
Ilya Makarov 2020-02-18 19:16:27 +03:00
parent 77cec4fde9
commit 9612d291ed

View File

@ -180,6 +180,13 @@ class VaultDestinationPlugin(DestinationPlugin):
"validation": "^([a-zA-Z0-9._-]+/?)+$",
"helpMessage": "Must be a valid Vault secrets path",
},
{
"name": "vaultSuffix",
"type": "str",
"required": False,
"validation": "^([a-zA-Z0-9._-]+/?)+$",
"helpMessage": "Must be a valid Vault secrets path",
},
{
"name": "objectName",
"type": "str",
@ -222,6 +229,7 @@ class VaultDestinationPlugin(DestinationPlugin):
token_file = self.get_option("vaultAuthTokenFile", options)
mount = self.get_option("vaultMount", options)
path = self.get_option("vaultPath", options)
suffix = self.get_option("vaultSuffix", options)
bundle = self.get_option("bundleChain", options)
obj_name = self.get_option("objectName", options)
api_version = self.get_option("vaultKvApiVersion", options)
@ -255,6 +263,9 @@ class VaultDestinationPlugin(DestinationPlugin):
path = "{0}/{1}".format(path, obj_name)
else:
path = "{0}/{1}".format(path, cname)
if suffix:
path = "{0}/{1}".format(path, suffix)
secret = get_secret(client, mount, path)
secret["data"][cname] = {}