From cffd5601b64140a55dccf13fef6fc722450e6b3d Mon Sep 17 00:00:00 2001 From: Marius Gedminas Date: Thu, 17 Nov 2016 20:24:37 +0200 Subject: [PATCH] letsencrypt: Locale-independent date parsing (#3314) Should fix #3155. --- lib/ansible/modules/extras/web_infrastructure/letsencrypt.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ansible/modules/extras/web_infrastructure/letsencrypt.py b/lib/ansible/modules/extras/web_infrastructure/letsencrypt.py index 88270126627..03c9932f1ab 100644 --- a/lib/ansible/modules/extras/web_infrastructure/letsencrypt.py +++ b/lib/ansible/modules/extras/web_infrastructure/letsencrypt.py @@ -20,6 +20,7 @@ import binascii import copy +import locale import textwrap from datetime import datetime @@ -769,6 +770,9 @@ def main(): ), supports_check_mode = True, ) + + # AnsibleModule() changes the locale, so change it back to C because we rely on time.strptime() when parsing certificate dates. + locale.setlocale(locale.LC_ALL, "C") cert_days = get_cert_days(module,module.params['dest']) if cert_days < module.params['remaining_days']: