mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Use namespace-aware meta importer for ipaplatform
Instead of symlinks and build-time configuration the ipaplatform module is now able to auto-detect platforms on import time. The meta importer uses the platform 'ID' from /etc/os-releases. It falls back to 'ID_LIKE' on platforms like CentOS, which has ID=centos and ID_LIKE="rhel fedora". The meta importer is able to handle namespace packages and the ipaplatform package has been turned into a namespace package in order to support external platform specifications. https://fedorahosted.org/freeipa/ticket/6474 Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
+3
-10
@@ -28,6 +28,7 @@ of the process.
|
||||
|
||||
For the per-request thread-local information, see `ipalib.request`.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import os
|
||||
from os import path
|
||||
@@ -39,6 +40,7 @@ from six.moves.urllib.parse import urlparse, urlunparse
|
||||
from six.moves.configparser import RawConfigParser, ParsingError
|
||||
# pylint: enable=import-error
|
||||
|
||||
from ipaplatform.tasks import tasks
|
||||
from ipapython.dn import DN
|
||||
from ipalib.base import check_name
|
||||
from ipalib.constants import (
|
||||
@@ -47,12 +49,6 @@ from ipalib.constants import (
|
||||
TLS_VERSIONS
|
||||
)
|
||||
from ipalib import errors
|
||||
try:
|
||||
# pylint: disable=ipa-forbidden-import
|
||||
from ipaplatform.tasks import tasks
|
||||
# pylint: enable=ipa-forbidden-import
|
||||
except ImportError:
|
||||
tasks = None
|
||||
|
||||
if six.PY3:
|
||||
unicode = str
|
||||
@@ -451,10 +447,7 @@ class Env(object):
|
||||
self.script = path.abspath(sys.argv[0])
|
||||
self.bin = path.dirname(self.script)
|
||||
self.home = os.environ.get('HOME', None)
|
||||
|
||||
# Set fips_mode only if ipaplatform module was loaded
|
||||
if tasks is not None:
|
||||
self.fips_mode = tasks.is_fips_enabled()
|
||||
self.fips_mode = tasks.is_fips_enabled()
|
||||
|
||||
# Merge in overrides:
|
||||
self._merge(**overrides)
|
||||
|
||||
@@ -37,6 +37,7 @@ if __name__ == '__main__':
|
||||
"ipalib.install",
|
||||
],
|
||||
install_requires=[
|
||||
"ipaplatform",
|
||||
"ipapython",
|
||||
"netaddr",
|
||||
"pyasn1",
|
||||
|
||||
+4
-3
@@ -55,6 +55,7 @@ from ipalib.constants import (
|
||||
TLS_VERSIONS, TLS_VERSION_MINIMAL, TLS_HIGH_CIPHERS
|
||||
)
|
||||
from ipalib.text import _
|
||||
from ipaplatform.paths import paths
|
||||
from ipapython.ssh import SSHPublicKey
|
||||
from ipapython.dn import DN, RDN
|
||||
from ipapython.dnsutil import DNSName
|
||||
@@ -1101,9 +1102,9 @@ def check_client_configuration():
|
||||
"""
|
||||
Check if IPA client is configured on the system.
|
||||
"""
|
||||
if (not os.path.isfile(_IPA_DEFAULT_CONF) or
|
||||
not os.path.isdir(_IPA_CLIENT_SYSRESTORE) or
|
||||
not os.listdir(_IPA_CLIENT_SYSRESTORE)):
|
||||
if (not os.path.isfile(paths.IPA_DEFAULT_CONF) or
|
||||
not os.path.isdir(paths.IPA_CLIENT_SYSRESTORE) or
|
||||
not os.listdir(paths.IPA_CLIENT_SYSRESTORE)):
|
||||
raise ScriptError('IPA client is not configured on this system')
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user