pgreco / rpms / ipa

Forked from forks/areguera/rpms/ipa 4 years ago
Clone

Blame SOURCES/0081-schema-check-Check-current-client-language-against-c.patch

403b09
From 70430cf0c22ab28a145de775aee343b3605c798a Mon Sep 17 00:00:00 2001
403b09
From: David Kupka <dkupka@redhat.com>
403b09
Date: Tue, 16 Aug 2016 15:36:07 +0200
403b09
Subject: [PATCH] schema check: Check current client language against cached
403b09
 one
403b09
403b09
https://fedorahosted.org/freeipa/ticket/6204
403b09
403b09
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
403b09
---
403b09
 ipaclient/remote_plugins/schema.py | 9 ++++++++-
403b09
 1 file changed, 8 insertions(+), 1 deletion(-)
403b09
403b09
diff --git a/ipaclient/remote_plugins/schema.py b/ipaclient/remote_plugins/schema.py
403b09
index e8b3f61bd8460c60630e8710028da79654819bd1..6fc70bf4b294badedd651e15b7e403cc40619f5c 100644
403b09
--- a/ipaclient/remote_plugins/schema.py
403b09
+++ b/ipaclient/remote_plugins/schema.py
403b09
@@ -7,6 +7,7 @@ import contextlib
403b09
 import errno
403b09
 import fcntl
403b09
 import json
403b09
+import locale
403b09
 import os
403b09
 import sys
403b09
 import time
403b09
@@ -440,14 +441,19 @@ class Schema(object):
403b09
             self._dict[ns] = {}
403b09
             self._namespaces[ns] = _SchemaNameSpace(self, ns)
403b09
 
403b09
+        self._language = (
403b09
+            locale.setlocale(locale.LC_ALL, '').split('.')[0].lower()
403b09
+        )
403b09
         try:
403b09
             self._fingerprint = server_info['fingerprint']
403b09
             self._expiration = server_info['expiration']
403b09
+            language = server_info['language']
403b09
         except KeyError:
403b09
             is_known = False
403b09
         else:
403b09
             is_known = (not api.env.force_schema_check and
403b09
-                        self._expiration > time.time())
403b09
+                        self._expiration > time.time() and
403b09
+                        self._language == language)
403b09
 
403b09
         if is_known:
403b09
             try:
403b09
@@ -470,6 +476,7 @@ class Schema(object):
403b09
 
403b09
         server_info['fingerprint'] = self._fingerprint
403b09
         server_info['expiration'] = self._expiration
403b09
+        server_info['language'] = self._language
403b09
 
403b09
     @contextlib.contextmanager
403b09
     def _open(self, filename, mode):
403b09
-- 
403b09
2.7.4
403b09