mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Match serials based on output position (fix for non-English languages)
This commit is contained in:
parent
0a08649637
commit
61f817d172
1 changed files with 4 additions and 2 deletions
|
@ -44,7 +44,8 @@ def get_cert_serial(cert_file):
|
|||
'''
|
||||
cmd = "certutil.exe -verify {0}".format(cert_file)
|
||||
out = __salt__['cmd.run'](cmd)
|
||||
matches = re.search(r"Serial: (.*)", out)
|
||||
# match serial number by paragraph to work with multiple languages
|
||||
matches = re.search(r":\w*(.*)\r\n\r\n", out)
|
||||
if matches is not None:
|
||||
return matches.groups()[0].strip()
|
||||
else:
|
||||
|
@ -66,7 +67,8 @@ def get_stored_cert_serials(store):
|
|||
'''
|
||||
cmd = "certutil.exe -store {0}".format(store)
|
||||
out = __salt__['cmd.run'](cmd)
|
||||
matches = re.findall(r"Serial Number: (.*)\r", out)
|
||||
# match serial numbers by header position to work with multiple languages
|
||||
matches = re.findall(r"={16}\r\n.*:\s*(\w*)\r\n", out)
|
||||
return matches
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue