compat: Save server's API version in for pre-schema servers

When client comunicates with server that doesn't support 'schema'
command it needs to determine its api version to be able to use the
right compat code. Storing information about server version reduces the
need to call 'env' or 'ping' command only to first time the server is
contacted.

https://fedorahosted.org/freeipa/ticket/6069

Reviewed-By: Jan Cholasta <jcholast@redhat.com>
This commit is contained in:
David Kupka
2016-07-26 13:35:22 +02:00
committed by Jan Cholasta
parent e76b0bbbcc
commit 229e2a1ed9
4 changed files with 112 additions and 94 deletions

View File

@@ -21,6 +21,8 @@
This base platform module exports default filesystem paths.
'''
import os
class BasePathNamespace(object):
BASH = "/bin/bash"
@@ -353,4 +355,17 @@ class BasePathNamespace(object):
IPA_CUSTODIA_AUDIT_LOG = '/var/log/ipa-custodia.audit.log'
IPA_GETKEYTAB = '/usr/sbin/ipa-getkeytab'
@property
def USER_CACHE_PATH(self):
return (
os.environ.get('XDG_CACHE_HOME') or
os.path.join(
os.environ.get(
'HOME',
os.path.expanduser('~')
),
'.cache'
)
)
path_namespace = BasePathNamespace