Add path suffix options

This commit is contained in:
Ilya Makarov 2020-02-18 19:16:27 +03:00
parent 77cec4fde9
commit 9612d291ed
1 changed files with 11 additions and 0 deletions

View File

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