The Identity, Policy and Audit system
CentOS Sources
2016-11-03 403b09ab980c02ef36095973349a13e0181c794a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From 444907f8dd6d840bfbb97cf65ae754f0d816f706 Mon Sep 17 00:00:00 2001
From: David Kupka <dkupka@redhat.com>
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 <jcholast@redhat.com>
---
 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 6fc70bf4b294badedd651e15b7e403cc40619f5c..8a77a15d489f067ab1312e863178458570403cc6 100644
--- a/ipaclient/remote_plugins/schema.py
+++ b/ipaclient/remote_plugins/schema.py
@@ -441,9 +441,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']
-- 
2.7.4