From be968ea01adf1721b0afd7393872a8d311d89d0c Mon Sep 17 00:00:00 2001 From: Florence Blanc-Renaud Date: Oct 24 2018 14:21:47 +0000 Subject: ipa-replica-install --setup-adtrust: check for package ipa-server-trust-ad When adding the option --setup-adtrust to ipa-replica-install, we need to check that the package freeipa-server-trust-ad is installed. To avoid relying on OS-specific commands like yum, the check is instead ensuring that the file /usr/share/ipa/smb.conf.empty is present (this file is delivered by the package). When the check is unsuccessful, ipa-replica-install exits with an error message. Fixes: https://pagure.io/freeipa/issue/7602 Reviewed-By: Alexander Bokovoy --- diff --git a/ipaplatform/base/constants.py b/ipaplatform/base/constants.py index be832fe..c67b991 100644 --- a/ipaplatform/base/constants.py +++ b/ipaplatform/base/constants.py @@ -15,6 +15,7 @@ class BaseConstantsNamespace(object): HTTPD_USER = "apache" HTTPD_GROUP = "apache" GSSPROXY_USER = "root" + IPA_ADTRUST_PACKAGE_NAME = "freeipa-server-trust-ad" IPA_DNS_PACKAGE_NAME = "freeipa-server-dns" KDCPROXY_USER = "kdcproxy" NAMED_USER = "named" diff --git a/ipaplatform/rhel/constants.py b/ipaplatform/rhel/constants.py index 945f3dc..72335ac 100644 --- a/ipaplatform/rhel/constants.py +++ b/ipaplatform/rhel/constants.py @@ -13,6 +13,7 @@ from ipaplatform.redhat.constants import RedHatConstantsNamespace class RHELConstantsNamespace(RedHatConstantsNamespace): + IPA_ADTRUST_PACKAGE_NAME = "ipa-server-trust-ad" IPA_DNS_PACKAGE_NAME = "ipa-server-dns" constants = RHELConstantsNamespace() diff --git a/ipaserver/install/adtrustinstance.py b/ipaserver/install/adtrustinstance.py index 3a751cc..67317ee 100644 --- a/ipaserver/install/adtrustinstance.py +++ b/ipaserver/install/adtrustinstance.py @@ -72,6 +72,15 @@ def check_inst(): "start the installation again") return False + # Check that ipa-server-trust-ad package is installed, + # by looking for the file /usr/share/ipa/smb.conf.empty + if not os.path.exists(os.path.join(paths.USR_SHARE_IPA_DIR, + "smb.conf.empty")): + print("AD Trust requires the '%s' package" % + constants.IPA_ADTRUST_PACKAGE_NAME) + print("Please install the package and start the installation again") + return False + #TODO: Add check for needed samba4 libraries return True