diff options
author | David Kupka <dkupka@redhat.com> | 2016-08-18 10:59:09 +0200 |
---|---|---|
committer | Jan Cholasta <jcholast@redhat.com> | 2016-08-18 12:12:51 +0200 |
commit | b6d5ed139b261b5db078ab652d22ea1d3b8092d3 (patch) | |
tree | b2ac60bbc1f5d4e982bffc4d98df5a54587e10c5 /ipaclient/remote_plugins/schema.py | |
parent | 44a2bdd8ead48b33b23bfb1e1f71027e5cfc5f04 (diff) | |
download | freeipa-b6d5ed139b261b5db078ab652d22ea1d3b8092d3.tar.gz freeipa-b6d5ed139b261b5db078ab652d22ea1d3b8092d3.tar.xz freeipa-b6d5ed139b261b5db078ab652d22ea1d3b8092d3.zip |
schema cache: Fallback to 'en_us' when locale is not available
https://fedorahosted.org/freeipa/ticket/6204
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Diffstat (limited to 'ipaclient/remote_plugins/schema.py')
-rw-r--r-- | ipaclient/remote_plugins/schema.py | 12 |
1 files 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'] |