ipaclient: remove hard dependency on ipaplatform

Hard-code the user cache directory path in ipaclient.remote_plugins.schema.

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

Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
This commit is contained in:
Jan Cholasta 2016-11-24 09:52:09 +01:00 committed by Martin Basti
parent 70c3cd7f48
commit a260fd8058
3 changed files with 13 additions and 19 deletions

View File

@ -12,7 +12,6 @@ import time
from . import compat
from . import schema
from ipaclient.plugins.rpcclient import rpcclient
from ipaplatform.paths import paths
from ipapython.dnsutil import DNSName
from ipapython.ipa_log_manager import log_mgr
@ -20,7 +19,7 @@ logger = log_mgr.get_logger(__name__)
class ServerInfo(collections.MutableMapping):
_DIR = os.path.join(paths.USER_CACHE_PATH, 'ipa', 'servers')
_DIR = os.path.join(schema.USER_CACHE_PATH, 'ipa', 'servers')
def __init__(self, api):
hostname = DNSName(api.env.server).ToASCII()

View File

@ -20,7 +20,6 @@ from ipalib.errors import SchemaUpToDate
from ipalib.frontend import Object
from ipalib.output import Output
from ipalib.parameters import DefaultFrom, Flag, Password, Str
from ipaplatform.paths import paths
from ipapython.ipautil import fsdecode
from ipapython.dn import DN
from ipapython.dnsutil import DNSName
@ -31,6 +30,17 @@ FORMAT = '1'
if six.PY3:
unicode = str
USER_CACHE_PATH = (
os.environ.get('XDG_CACHE_HOME') or
os.path.join(
os.environ.get(
'HOME',
os.path.expanduser('~')
),
'.cache'
)
)
_TYPES = {
'DN': DN,
'DNSName': DNSName,
@ -357,7 +367,7 @@ class Schema(object):
"""
namespaces = {'classes', 'commands', 'topics'}
_DIR = os.path.join(paths.USER_CACHE_PATH, 'ipa', 'schema', FORMAT)
_DIR = os.path.join(USER_CACHE_PATH, 'ipa', 'schema', FORMAT)
def __init__(self, client, fingerprint=None):
self._dict = {}

View File

@ -21,8 +21,6 @@
This base platform module exports default filesystem paths.
'''
import os
class BasePathNamespace(object):
BASH = "/bin/bash"
@ -350,17 +348,4 @@ class BasePathNamespace(object):
IPA_GETKEYTAB = '/usr/sbin/ipa-getkeytab'
EXTERNAL_SCHEMA_DIR = '/usr/share/ipa/schema.d'
@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