pgreco / rpms / ipa

Forked from forks/areguera/rpms/ipa 4 years ago
Clone

Blame SOURCES/0012-ipa-replica-install_--setup-adtrust_check_for_package_ipa-server-trust-ad_rhbz#1658294.patch

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