1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Add python level locale handling back (#31339)

locale.setlocale() call removed in 6b5291d68f150c629e9958bb6e910b529b0d8cef
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:
Jacek Tomasiak 2017-11-27 22:52:24 +01:00 committed by Sam Doran
parent cbf28c20cb
commit fd4a6cf7ad

View file

@ -155,6 +155,7 @@ import binascii
import copy
import hashlib
import json
import locale
import os
import re
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.
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'])
if cert_days < module.params['remaining_days']: