Suppress output of crypt context and be more specifc with whitespace vs. serial

This commit is contained in:
Morgan Willcock 2017-06-02 20:12:16 +01:00
parent 61f817d172
commit 8ee48432f4

View file

@ -42,10 +42,10 @@ def get_cert_serial(cert_file):
salt '*' certutil.get_cert_serial <certificate name>
'''
cmd = "certutil.exe -verify {0}".format(cert_file)
cmd = "certutil.exe -silent -verify {0}".format(cert_file)
out = __salt__['cmd.run'](cmd)
# match serial number by paragraph to work with multiple languages
matches = re.search(r":\w*(.*)\r\n\r\n", out)
matches = re.search(r":\s*(\w*)\r\n\r\n", out)
if matches is not None:
return matches.groups()[0].strip()
else: