From b6d5ed139b261b5db078ab652d22ea1d3b8092d3 Mon Sep 17 00:00:00 2001 From: David Kupka Date: Thu, 18 Aug 2016 10:59:09 +0200 Subject: [PATCH] schema cache: Fallback to 'en_us' when locale is not available https://fedorahosted.org/freeipa/ticket/6204 Reviewed-By: Jan Cholasta --- ipaclient/remote_plugins/schema.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ipaclient/remote_plugins/schema.py b/ipaclient/remote_plugins/schema.py index ff7af6596..553da3512 100644 --- a/ipaclient/remote_plugins/schema.py +++ b/ipaclient/remote_plugins/schema.py @@ -371,9 +371,15 @@ class Schema(object): self._dict[ns] = {} self._namespaces[ns] = _SchemaNameSpace(self, ns) - self._language = ( - locale.setlocale(locale.LC_ALL, '').split('.')[0].lower() - ) + # copy-paste from ipalib/rpc.py + try: + self._language = ( + locale.setlocale(locale.LC_ALL, '').split('.')[0].lower() + ) + except locale.Error: + # fallback to default locale + self._language = 'en_us' + try: self._fingerprint = server_info['fingerprint'] self._expiration = server_info['expiration']