summaryrefslogtreecommitdiffstats
path: root/ipaclient/remote_plugins
diff options
context:
space:
mode:
authorDavid Kupka <dkupka@redhat.com>2016-08-16 15:36:07 +0200
committerJan Cholasta <jcholast@redhat.com>2016-08-17 14:16:04 +0200
commit4b43558b1c2301f40fea0afc8d9d5baf53aaaf6a (patch)
tree015e8805b6c7b99759068438a5ff7a96e27a6baf /ipaclient/remote_plugins
parentf2c26119f5bb0e45c3d85c9b13150ba503f492e8 (diff)
downloadfreeipa-4b43558b1c2301f40fea0afc8d9d5baf53aaaf6a.tar.gz
freeipa-4b43558b1c2301f40fea0afc8d9d5baf53aaaf6a.tar.xz
freeipa-4b43558b1c2301f40fea0afc8d9d5baf53aaaf6a.zip
schema check: Check current client language against cached one
https://fedorahosted.org/freeipa/ticket/6204 Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Diffstat (limited to 'ipaclient/remote_plugins')
-rw-r--r--ipaclient/remote_plugins/schema.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/ipaclient/remote_plugins/schema.py b/ipaclient/remote_plugins/schema.py
index 4b03e0d3e..ff7af6596 100644
--- a/ipaclient/remote_plugins/schema.py
+++ b/ipaclient/remote_plugins/schema.py
@@ -7,6 +7,7 @@ import contextlib
import errno
import fcntl
import json
+import locale
import os
import sys
import time
@@ -370,14 +371,19 @@ class Schema(object):
self._dict[ns] = {}
self._namespaces[ns] = _SchemaNameSpace(self, ns)
+ self._language = (
+ locale.setlocale(locale.LC_ALL, '').split('.')[0].lower()
+ )
try:
self._fingerprint = server_info['fingerprint']
self._expiration = server_info['expiration']
+ language = server_info['language']
except KeyError:
is_known = False
else:
is_known = (not api.env.force_schema_check and
- self._expiration > time.time())
+ self._expiration > time.time() and
+ self._language == language)
if is_known:
try:
@@ -400,6 +406,7 @@ class Schema(object):
server_info['fingerprint'] = self._fingerprint
server_info['expiration'] = self._expiration
+ server_info['language'] = self._language
@contextlib.contextmanager
def _open(self, filename, mode):