On 18/12/15 15:39, Petr Vobornik wrote:
On 12/18/2015 12:04 PM, Petr Vobornik wrote:
On 12/18/2015 11:26 AM, David Kupka wrote:
Standalone DNS installer always performed overlap check effectively
preventing installation on replica when other DNS instance was already
installed in topology.



I don't like the position of api argument in the install_check. It is
not consistent with install_check in KRA plus it's between two related
options: standalone and replica.

Is there a reason behind it which I don't see?

NACK, the API call is incorrect.

It should be api.Command['dns_is_enabled']()['result'] or
api.Command.dns_is_enabled()['result']


ipa-dns-install --forwarder=$DNS_FORWARDER

The log file for this installation can be found in
/var/log/ipaserver-install.log
Unexpected error - see /var/log/ipaserver-install.log for details:
TypeError: __call__() takes exactly 1 argument (2 given)


log file:

2015-12-18T14:33:30Z DEBUG   File
"/usr/lib/python2.7/site-packages/ipaserver/install/installutils.py",
line 736, in run_script
     return_value = main_function()

   File "/sbin/ipa-dns-install", line 137, in main
     dns_installer.install_check(True, api, False, options,
hostname=api.env.host)

   File "/usr/lib/python2.7/site-packages/ipaserver/install/dns.py",
line 113, in install_check
     already_enabled = api.Command('dns_is_enabled')['result']

2015-12-18T14:33:30Z DEBUG The ipa-dns-install command failed,
exception: TypeError: __call__() takes exactly 1 argument (2 given)

Thanks for catch. Sometimes I mess up with patch files. Fixed patch attached.

--
David Kupka
From 33a763f4aadb06d4c2c5741f69324d61969cad8a Mon Sep 17 00:00:00 2001
From: David Kupka <dku...@redhat.com>
Date: Thu, 17 Dec 2015 16:16:09 +0100
Subject: [PATCH] ipa-dns-install: Do not check for zone overlap when DNS
 installed.

When DNS is already installed somewhere in topology we should not check for
zone overlap because it would always say that we are overlapping our own domain.
ipa-replica-install already does that but ipa-dns-install did not.
---
 install/tools/ipa-dns-install              |  2 +-
 ipaserver/install/dns.py                   | 24 ++++++++----------------
 ipaserver/install/server/install.py        |  2 +-
 ipaserver/install/server/replicainstall.py |  4 ++--
 4 files changed, 12 insertions(+), 20 deletions(-)

diff --git a/install/tools/ipa-dns-install b/install/tools/ipa-dns-install
index eebc9e2ad8a6da71807b7d9d24cd41289c5b4d58..ee7ebe0bdcd2dde9ec1bcbe9f54dbe1baf3db9b2 100755
--- a/install/tools/ipa-dns-install
+++ b/install/tools/ipa-dns-install
@@ -134,7 +134,7 @@ def main():
 
     options.setup_ca = None  # must be None to enable autodetection
 
-    dns_installer.install_check(True, False, options, hostname=api.env.host)
+    dns_installer.install_check(True, api, False, options, hostname=api.env.host)
     dns_installer.install(True, False, options)
 
     # Restart http instance to make sure that python-dns has the right resolver
diff --git a/ipaserver/install/dns.py b/ipaserver/install/dns.py
index 763b2aca475d5f5b25d2aded05bc540ce3836f81..9a2fde29f613a3ce07b4f85f5ae2a856b806bdc8 100644
--- a/ipaserver/install/dns.py
+++ b/ipaserver/install/dns.py
@@ -99,20 +99,7 @@ def _disable_dnssec():
             conn.update_entry(entry)
 
 
-def check_dns_enabled(api):
-    try:
-        api.Backend.rpcclient.connect()
-        result = api.Backend.rpcclient.forward(
-            'dns_is_enabled',
-            version=u'2.112',    # All the way back to 3.0 servers
-        )
-        return result['result']
-    finally:
-        if api.Backend.rpcclient.isconnected():
-            api.Backend.rpcclient.disconnect()
-
-
-def install_check(standalone, replica, options, hostname):
+def install_check(standalone, api, replica, options, hostname):
     global ip_addresses
     global reverse_zones
     fstore = sysrestore.FileStore(paths.SYSRESTORE)
@@ -121,8 +108,13 @@ def install_check(standalone, replica, options, hostname):
         raise RuntimeError("Integrated DNS requires '%s' package" %
                            constants.IPA_DNS_PACKAGE_NAME)
 
-    # when installing first replica with DNS we need to check zone overlap
-    if not replica or not check_dns_enabled(api):
+    # when installing first DNS instance we need to check zone overlap
+    if replica or standalone:
+        already_enabled = api.Command.dns_is_enabled()['result']
+    else:
+        already_enabled = False
+
+    if not already_enabled:
         domain = dnsutil.DNSName(util.normalize_zone(api.env.domain))
         print("Checking DNS domain %s, please wait ..." % domain)
         try:
diff --git a/ipaserver/install/server/install.py b/ipaserver/install/server/install.py
index a07ca664e263a1bb49c6f5e18bc888fa66e56b55..78cc5a4f5cfe1ee440392f9e0a7f5a508a32d4ab 100644
--- a/ipaserver/install/server/install.py
+++ b/ipaserver/install/server/install.py
@@ -706,7 +706,7 @@ def install_check(installer):
             sys.exit(1)
 
     if options.setup_dns:
-        dns.install_check(False, False, options, host_name)
+        dns.install_check(False, api, False, options, host_name)
         ip_addresses = dns.ip_addresses
     else:
         ip_addresses = get_server_ip_address(host_name,
diff --git a/ipaserver/install/server/replicainstall.py b/ipaserver/install/server/replicainstall.py
index 4e6abde0e424aaacd06d5d782aab0c260f1b07ab..63fe02b5cbb5c8a2a4be6ffdceaaf0200a1c7969 100644
--- a/ipaserver/install/server/replicainstall.py
+++ b/ipaserver/install/server/replicainstall.py
@@ -653,7 +653,7 @@ def install_check(installer):
             conn.disconnect()
 
     if options.setup_dns:
-        dns.install_check(False, True, options, config.host_name)
+        dns.install_check(False, remote_api, True, options, config.host_name)
         config.ips = dns.ip_addresses
     else:
         config.ips = installutils.get_server_ip_address(
@@ -1175,7 +1175,7 @@ def promote_check(installer):
             conn.disconnect()
 
     if options.setup_dns:
-        dns.install_check(False, True, options, config.host_name)
+        dns.install_check(False, remote_api, True, options, config.host_name)
     else:
         config.ips = installutils.get_server_ip_address(
             config.host_name, not installer.interactive,
-- 
2.5.0

-- 
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