updated pki.py script

This commit is contained in:
Paul 2021-09-25 16:14:50 +02:00
parent 283fc7bf32
commit d0d57526c8

View File

@ -8,7 +8,7 @@ def fetched(name=None,
username=None, username=None,
password=None, password=None,
domains=None, domains=None,
certfile=None, fullcertfile=None,
keyfile=None): keyfile=None):
ret = { ret = {
@ -22,7 +22,7 @@ def fetched(name=None,
currentkey = None currentkey = None
domain_concat = ",".join(domains) domain_concat = ",".join(domains)
currentcert = __salt__['pki.get_file_content'](checkfile=certfile) currentcert = __salt__['pki.get_file_content'](checkfile=fullcertfile)
currentkey = __salt__['pki.get_file_content'](checkfile=keyfile) currentkey = __salt__['pki.get_file_content'](checkfile=keyfile)
newcert, newkey = __salt__['pki.get_pki_cert'](url=url, newcert, newkey = __salt__['pki.get_pki_cert'](url=url,
@ -31,7 +31,7 @@ def fetched(name=None,
domains=domain_concat) domains=domain_concat)
if currentcert != newcert or currentkey != newkey: if currentcert != newcert or currentkey != newkey:
wcert = __salt__['pki.write_file_content'](newcert, certfile) wcert = __salt__['pki.write_file_content'](newcert, fullcertfile)
wkey = __salt__['pki.write_file_content'](newkey, keyfile) wkey = __salt__['pki.write_file_content'](newkey, keyfile)
ret["changes"]["old"] = "\n".join([currentcert, currentkey]) ret["changes"]["old"] = "\n".join([currentcert, currentkey])