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:
Christian Heimes
2017-11-15 14:17:24 +01:00
parent f6adf4f3a8
commit a48f6511f6
41 changed files with 422 additions and 141 deletions
+3 -10
View File
@@ -16,6 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from __future__ import absolute_import
# pylint: disable=deprecated-module
from optparse import (
@@ -33,18 +34,10 @@ from six.moves.configparser import SafeConfigParser
from six.moves.urllib.parse import urlsplit
# pylint: enable=import-error
from ipaplatform.paths import paths
from ipapython.dn import DN
from ipapython.ipautil import CheckedIPAddress, CheckedIPAddressLoopback
try:
# pylint: disable=ipa-forbidden-import
from ipaplatform.paths import paths
# pylint: enable=ipa-forbidden-import
except ImportError:
IPA_DEFAULT_CONF = '/etc/ipa/default.conf'
else:
IPA_DEFAULT_CONF = paths.IPA_DEFAULT_CONF
class IPAConfigError(Exception):
def __init__(self, msg=''):
@@ -188,7 +181,7 @@ config = IPAConfig()
def __parse_config(discover_server = True):
p = SafeConfigParser()
p.read(IPA_DEFAULT_CONF)
p.read(paths.IPA_DEFAULT_CONF)
try:
if not config.default_realm: