From fd4a6cf7ad7012a07b29096f5c70f34499af1216 Mon Sep 17 00:00:00 2001 From: Jacek Tomasiak Date: Mon, 27 Nov 2017 22:52:24 +0100 Subject: [PATCH] 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. --- lib/ansible/modules/web_infrastructure/letsencrypt.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ansible/modules/web_infrastructure/letsencrypt.py b/lib/ansible/modules/web_infrastructure/letsencrypt.py index e3bf02da4a5..a88297257d5 100644 --- a/lib/ansible/modules/web_infrastructure/letsencrypt.py +++ b/lib/ansible/modules/web_infrastructure/letsencrypt.py @@ -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']: