Add python level locale handling back (#31339)
locale.setlocale() call removed in 6b5291d68f
is actually needed by time.strptime(). AnsibleModule() changes both: environment
variables and python level locale settings so both need to be reset.
This commit is contained in:
parent
cbf28c20cb
commit
fd4a6cf7ad
1 changed files with 2 additions and 0 deletions
|
@ -155,6 +155,7 @@ import binascii
|
||||||
import copy
|
import copy
|
||||||
import hashlib
|
import hashlib
|
||||||
import json
|
import json
|
||||||
|
import locale
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
|
@ -805,6 +806,7 @@ def main():
|
||||||
|
|
||||||
# AnsibleModule() changes the locale, so change it back to C because we rely on time.strptime() when parsing certificate dates.
|
# AnsibleModule() changes the locale, so change it back to C because we rely on time.strptime() when parsing certificate dates.
|
||||||
module.run_command_environ_update = dict(LANG='C', LC_ALL='C', LC_MESSAGES='C', LC_CTYPE='C')
|
module.run_command_environ_update = dict(LANG='C', LC_ALL='C', LC_MESSAGES='C', LC_CTYPE='C')
|
||||||
|
locale.setlocale(locale.LC_ALL, 'C')
|
||||||
|
|
||||||
cert_days = get_cert_days(module, module.params['dest'])
|
cert_days = get_cert_days(module, module.params['dest'])
|
||||||
if cert_days < module.params['remaining_days']:
|
if cert_days < module.params['remaining_days']:
|
||||||
|
|
Loading…
Reference in a new issue