https://fedorahosted.org/freeipa/ticket/4058
Requires patch freeipa-pspacek-0052

Patch attached.

--
Martin Basti

From df79ebacc24299178d222f1dd83507e2ba15f479 Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Wed, 1 Jul 2015 15:05:45 +0200
Subject: [PATCH] DNS: check if DNS package is installed

Instead of separate checking of DNS required packages, we need just
check if IPA DNS package is installed.

https://fedorahosted.org/freeipa/ticket/4058
---
 ipaplatform/base/paths.py               |  1 +
 ipaplatform/base/tasks.py               |  6 ++++++
 ipaplatform/redhat/tasks.py             |  5 +++++
 ipaplatform/rhel/tasks.py               |  7 ++++++-
 ipaserver/install/bindinstance.py       | 19 +------------------
 ipaserver/install/dns.py                | 11 ++++++-----
 ipaserver/install/dnskeysyncinstance.py |  6 ------
 ipaserver/install/opendnssecinstance.py |  8 --------
 8 files changed, 25 insertions(+), 38 deletions(-)

diff --git a/ipaplatform/base/paths.py b/ipaplatform/base/paths.py
index ab88e8f12d915af033e7117adb7f7ea2f0a32e3e..88324d85fec24786d370da69ede91ee4191c0ac5 100644
--- a/ipaplatform/base/paths.py
+++ b/ipaplatform/base/paths.py
@@ -149,6 +149,7 @@ class BasePathNamespace(object):
     ROOT_TMP_CA_P12 = "/root/tmp-ca.p12"
     NAMED_PID = "/run/named/named.pid"
     IP = "/sbin/ip"
+    IPA_DNS_INSTALL = "/sbin/ipa-dns-install"
     NOLOGIN = "/sbin/nologin"
     SBIN_REBOOT = "/sbin/reboot"
     SBIN_RESTORECON = "/sbin/restorecon"
diff --git a/ipaplatform/base/tasks.py b/ipaplatform/base/tasks.py
index 10c5e835d0d585caa989c7744d3bae9f253de0d3..f06b81b83061bf14542c69027da148609a882d6e 100644
--- a/ipaplatform/base/tasks.py
+++ b/ipaplatform/base/tasks.py
@@ -218,5 +218,11 @@ class BaseTaskNamespace(object):
         """
         return parse_version(version)
 
+    def get_ipa_dns_package_name(self):
+        """
+        Return package name for IPA DNS
+        """
+        return
+
 
 task_namespace = BaseTaskNamespace()
diff --git a/ipaplatform/redhat/tasks.py b/ipaplatform/redhat/tasks.py
index b26604aa736eb472c88bc0dcbc3a4b515712ce9d..e83b5d80ac84f9db21cb9ddcd26592436db27a9b 100644
--- a/ipaplatform/redhat/tasks.py
+++ b/ipaplatform/redhat/tasks.py
@@ -414,5 +414,10 @@ class RedHatTaskNamespace(BaseTaskNamespace):
         super(RedHatTaskNamespace, self).create_system_user(name, group,
             homedir, shell, uid, gid, comment)
 
+    def get_ipa_dns_package_name(self):
+        """
+        Return package name for IPA DNS
+        """
+        return "freeipa-server-dns"
 
 tasks = RedHatTaskNamespace()
diff --git a/ipaplatform/rhel/tasks.py b/ipaplatform/rhel/tasks.py
index 75158066521f47636299166fe939e3947eef530d..5dcbe6e325e1092e649dd6b628e60457593bafcd 100644
--- a/ipaplatform/rhel/tasks.py
+++ b/ipaplatform/rhel/tasks.py
@@ -25,7 +25,12 @@ from ipaplatform.redhat.tasks import RedHatTaskNamespace
 
 
 class RHELTaskNamespace(RedHatTaskNamespace):
-    pass
+
+    def get_ipa_dns_package_name(self):
+        """
+        Return package name for IPA DNS
+        """
+        return "ipa-server-dns"
 
 
 tasks = RHELTaskNamespace()
diff --git a/ipaserver/install/bindinstance.py b/ipaserver/install/bindinstance.py
index 77ff342d770ee1bb42521a3373df797663afd7b5..f6099afa1d43addd969ecaf788a29aed4d923a01 100644
--- a/ipaserver/install/bindinstance.py
+++ b/ipaserver/install/bindinstance.py
@@ -63,25 +63,8 @@ named_conf_arg_options_template_nonstr = "%(indent)s%(name)s %(value)s;\n"
 named_conf_include_re = re.compile(r'\s*include\s+"(?P<path>)"\s*;')
 named_conf_include_template = "include \"%(path)s\";\n"
 
+
 def check_inst(unattended):
-    has_bind = True
-    named = services.knownservices.named
-    if not os.path.exists(named.get_binary_path()):
-        print "BIND was not found on this system"
-        print ("Please install the '%s' package and start the installation again"
-              % named.get_package_name())
-        has_bind = False
-
-    # Also check for the LDAP BIND plug-in
-    if not os.path.exists(paths.BIND_LDAP_SO) and \
-       not os.path.exists(paths.BIND_LDAP_SO_64):
-        print "The BIND LDAP plug-in was not found on this system"
-        print "Please install the 'bind-dyndb-ldap' package and start the installation again"
-        has_bind = False
-
-    if not has_bind:
-        return False
-
     if not unattended and os.path.exists(NAMED_CONF):
         msg = "Existing BIND configuration detected, overwrite?"
         return ipautil.user_input(msg, False)
diff --git a/ipaserver/install/dns.py b/ipaserver/install/dns.py
index d22bce7a7cd2e0e8a7ffe0ab4aa496634465903b..206296dddade0a0a3c8b2ed933692ae05deb7630 100644
--- a/ipaserver/install/dns.py
+++ b/ipaserver/install/dns.py
@@ -9,6 +9,7 @@ from subprocess import CalledProcessError
 from ipalib import api
 from ipalib import errors
 from ipaplatform.paths import paths
+from ipaplatform.tasks import tasks
 from ipaplatform import services
 from ipapython import ipautil
 from ipapython import sysrestore
@@ -96,6 +97,10 @@ def install_check(standalone, replica, options, hostname):
     global reverse_zones
     fstore = sysrestore.FileStore(paths.SYSRESTORE)
 
+    if not ipautil.file_exists(paths.IPA_DNS_INSTALL):
+        raise RuntimeError("Integrated DNS requires '%s' package" %
+                           tasks.get_ipa_dns_package_name())
+
     if standalone:
         print "=============================================================================="
         print "This program will setup DNS for the FreeIPA Server."
@@ -141,8 +146,7 @@ def install_check(standalone, replica, options, hostname):
         sys.exit("Aborted")
 
     # Check bind packages are installed
-    if not (bindinstance.check_inst(options.unattended) and
-            dnskeysyncinstance.check_inst()):
+    if not bindinstance.check_inst(options.unattended):
         sys.exit("Aborting installation.")
 
     if options.disable_dnssec_master:
@@ -177,9 +181,6 @@ def install_check(standalone, replica, options, hostname):
             sys.exit("Only one DNSSEC key master is supported in current "
                      "version.")
 
-        # check opendnssec packages are installed
-        if not opendnssecinstance.check_inst():
-            sys.exit("Aborting installation")
         if options.kasp_db_file:
             dnskeysyncd = services.service('ipa-dnskeysyncd')
 
diff --git a/ipaserver/install/dnskeysyncinstance.py b/ipaserver/install/dnskeysyncinstance.py
index eb6d07f014bce296a5b094f499194286c31c2489..7d1351ccc57a5dbd7d537741545ad44d0dcd5eb1 100644
--- a/ipaserver/install/dnskeysyncinstance.py
+++ b/ipaserver/install/dnskeysyncinstance.py
@@ -30,12 +30,6 @@ softhsm_token_label = u'ipaDNSSEC'
 softhsm_slot = 0
 replica_keylabel_template = u"dnssec-replica:%s"
 
-def check_inst():
-    if not os.path.exists(paths.DNSSEC_KEYFROMLABEL):
-        print ("Please install the 'bind-pkcs11-utils' package and start "
-               "the installation again")
-        return False
-    return True
 
 def dnssec_container_exists(fqdn, suffix, dm_password=None, ldapi=False,
                             realm=None, autobind=ipaldap.AUTOBIND_DISABLED):
diff --git a/ipaserver/install/opendnssecinstance.py b/ipaserver/install/opendnssecinstance.py
index d68691fa32f135c7527ce28ed771757eadab4831..0f1af828ea245046330fdfab77db130ca14faba3 100644
--- a/ipaserver/install/opendnssecinstance.py
+++ b/ipaserver/install/opendnssecinstance.py
@@ -55,14 +55,6 @@ def get_dnssec_key_masters(conn):
     return keymasters_list
 
 
-def check_inst():
-    if not os.path.exists(paths.ODS_KSMUTIL):
-        print ("Please install the 'opendnssec' package and start "
-               "the installation again")
-        return False
-    return True
-
-
 class OpenDNSSECInstance(service.Service):
     def __init__(self, fstore=None, dm_password=None, ldapi=False,
                  start_tls=False, autobind=ipaldap.AUTOBIND_ENABLED):
-- 
2.4.3

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to