This commit is contained in:
Ilya Makarov 2020-03-11 15:15:56 +03:00
parent ba8e315eed
commit a6c3b85fe1
1 changed files with 14 additions and 20 deletions

View File

@ -242,13 +242,7 @@ class VaultDestinationPlugin(DestinationPlugin):
:return: :return:
""" """
cert = parse_certificate(body) cert = parse_certificate(body)
cname = common_name(cert)
cn = common_name(cert)
ou= organizational_unit(cert)
o= organization(cert)
l= location(cert)
s= state(cert)
c= country(cert)
url = self.get_option("vaultUrl", options) url = self.get_option("vaultUrl", options)
auth_method = self.get_option("authenticationMethod", options) auth_method = self.get_option("authenticationMethod", options)
@ -293,23 +287,23 @@ class VaultDestinationPlugin(DestinationPlugin):
client.secrets.kv.default_kv_version = api_version client.secrets.kv.default_kv_version = api_version
t_path = path.format( t_path = path.format(
CN=cn, CN=cname,
OU=ou, OU=organizational_unit(cert),
O=o, O=organization(cert),
L=l, L=location(cert),
S=s, S=state(cert),
C=c C=country(cert)
) )
if not obj_name: if not obj_name:
obj_name = '{CN}' obj_name = '{CN}'
f_obj_name = obj_name.format( f_obj_name = obj_name.format(
CN=cn, CN=cname,
OU=ou, OU=organizational_unit(cert),
O=o, O=organization(cert),
L=l, L=location(cert),
S=s, S=state(cert),
C=c C=country(cert)
) )
path = "{0}/{1}".format(t_path, f_obj_name) path = "{0}/{1}".format(t_path, f_obj_name)