#6474 Remove ipaplatform dependency from ipa modules
Closed: Fixed Opened by cheimes.

EDIT: aim of this ticket has been changed to remove dependency of ipaplatform from client libraries.

Currently ipaplatform's platform is detected and selected on build time by configure. The script uses /etc/os-release ID field as platform selector and creates symlinks from ipaplatform/$PLATFORM/module.py to ipaplatform/module.py. The approach basically hard-codes a platform on build time.

While the approach is reasonable for distribution packages like RPM, it doesn't work for Python wheels and PyPI packages. In order to make an ipaplatform wheel package usable on another platform (e.g. build on fedora, imported on centos), ipaplatform has to select the platform at runtime.

I propose to parse /etc/os-release at import time and auto-detect the best matching platform based on ID and ID_LIKE.

Related to that, ipaplatform also should become a namespace package. A namespace package allows 3rd parties to add their own platform definition as external packages.


See #6475 for ipaplatform.debian support.

I forgot to explain ID and ID_LIKE. ID_LIKE contains a space separated list of similar distributions. For example CentOS has ID=centos and ID_LIKE="rhel fedora". With my proposal CentOS will automatically use ipaplatform.rhel.

It has been decided that it'd be better to rather strip the critical modules off the ipaplatform dependency:
Integration Improvements ML thread.
This should be worked in the design page.

Closing per triage from Mon Nov 21.

Different approach was decided.

Platform dependent code will be removed from libraries.

Push failed, reopening.

It was actually pushed, an error in tooling occured

master:

  • 9117a5d5a6ae7b3b97407e46f81a06c387974d7f paths: remove DEV_NULL
  • 8e5d2c7014ff6371a3b306e666c301aea1f7a488 custodiainstance: automatic restart on config file update
  • a1f260d021bf5d018e634438fde6b7c81ebbbcef ipapython: move dnssec, p11helper and secrets to ipaserver
  • 26c46a447f82b4cf37a5076b72cf6328857d5f35 ipapython: move certmonger and sysrestore to ipalib.install
  • f919ab4ee0ec26d77ee6978e75de5daba4073402 certdb: use a temporary file to pass password to pk12util
  • d6b755e3fcaf32158f4ee36d45e3344b4a03fbc2 ipautil: remove SHARE_DIR and PLUGIN_SHARE_DIR
  • 7b966e8577fdb56f069cf26a6ab4d6c77b8743b9 ipautil: remove get_domain_name()
  • d911f493482d29829199cce2f91f88a9b53369e1 ipautil: remove the timeout argument of run()
  • 75b70e3f0d52a9c98f443d3fc2f7cef92bdc7b1a ipautil: move is_fips_enabled() to ipaplatform.tasks
  • 7d5c680ace7ccea3b0f7f1471cf8dbc07b3da5a1 ipautil: move kinit functions to ipalib.install
  • 6e50fae9ec6dea35e12a65dbc46228a1e6276e07 ipautil: move file encryption functions to installutils
  • 528012fe8a8976961203021ef36353b7a4c3b8a8 ipapython: remove hard dependency on ipaplatform
  • a2c58889735c794cd1e93331c755b6f9ba273773 ipalib: move certstore to the install subpackage
  • 977050c66bccd7b8cf468c115d73250505a01034 constants: remove CACERT
  • d43b57d2ce8552ed4977dcc33667b4226fe3333b ipalib: remove hard dependency on ipapython
  • 70c3cd7f482bee7d5ad12062daa7ad6181a29094 ipaclient: move install modules to the install subpackage
  • a260fd8058d757b631dd4eb39ee8a58b91cf2efb ipaclient: remove hard dependency on ipaplatform

Two relevant files still import ipaplatform:

ipatests/test_ipalib/test_errors.py:from ipaplatform.paths import paths
ipatests/test_ipalib/test_config.py:from ipaplatform.paths import paths

The line https://github.com/freeipa/freeipa/blob/master/ipapython/certdb.py#L35 needs a pylint disable comment. The assignment of CERTUTIL, PK12UTIL and OPENSSL should be moved into a else block, too.

master:

  • 235f68524767c1eb2e12fb6d1d9f6a520414c583 Wheel bundles fixes

https://github.com/freeipa/freeipa/pull/295 addresses comment 12 and 13.

pr 295 pushed. Christian is it all, can the ticket be closed?

master:

  • fb307ba582d4e7339b7026cbe26c3b170221e249 Add pylint guard to import of ipaplatform in ipapython.certdb
  • 3e3b5462b28f2133fd4170645cad762c0a0fbb4f Remove BIN_FALSE and BIN_TRUE
  • 98f0077360884da6df31b351caaed7510dec94de Remove import of ipaplatform.paths from test_ipalib

Yes, all ok.

Metadata Update from @cheimes:
- Issue assigned to someone
- Issue set to the milestone: FreeIPA 4.5

master:

  • 490682ac3cab8978635655bdcc880f28227e900b Make ipaplatform a regular top-level package

ipa-4-8:

  • 07da5abd13a0691d5c9fc0c37609ebcb543c691e Make ipaplatform a regular top-level package
Metadata