Blame SOURCES/0001-DNS-install-check-Fix-overlapping-DNS-zone-from-the-master-itself_2c2cef7_rhbz#1784003.patch

177dc6
From 2c2cef7063315766d893b275185b422be3f3c019 Mon Sep 17 00:00:00 2001
177dc6
From: Thomas Woerner <twoerner@redhat.com>
177dc6
Date: Dec 16 2019 20:37:17 +0000
177dc6
Subject: DNS install check: Fix overlapping DNS zone from the master itself
177dc6
177dc6
177dc6
The change to allow overlapping zone to be from the master itself has
177dc6
introduced two issues: The check for the master itself should only executed
177dc6
if options.force and options.allow_zone_overlap are both false and the
177dc6
reverse zone check later on was still handling ValueError instead of
177dc6
dnsutil.DNSZoneAlreadyExists.
177dc6
177dc6
Both issues have been fixed and the deployment with existing name servers
177dc6
is properly working again.
177dc6
177dc6
Fixes: https://pagure.io/freeipa/issue/8150
177dc6
Signed-off-by: Thomas Woerner <twoerner@redhat.com>
177dc6
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
177dc6
177dc6
---
177dc6
177dc6
diff --git a/ipaserver/install/dns.py b/ipaserver/install/dns.py
177dc6
index 36ba6f8..9f08e86 100644
177dc6
--- a/ipaserver/install/dns.py
177dc6
+++ b/ipaserver/install/dns.py
177dc6
@@ -135,15 +135,15 @@ def install_check(standalone, api, replica, options, hostname):
177dc6
                 logger.warning("%s Please make sure that the domain is "
177dc6
                                "properly delegated to this IPA server.",
177dc6
                                e)
177dc6
-
177dc6
-            hst = dnsutil.DNSName(hostname).make_absolute().to_text()
177dc6
-            if hst not in e.kwargs['ns']:
177dc6
-                raise ValueError(str(e))
177dc6
+            else:
177dc6
+                hst = dnsutil.DNSName(hostname).make_absolute().to_text()
177dc6
+                if hst not in e.kwargs['ns']:
177dc6
+                    raise ValueError(str(e))
177dc6
 
177dc6
     for reverse_zone in options.reverse_zones:
177dc6
         try:
177dc6
             dnsutil.check_zone_overlap(reverse_zone)
177dc6
-        except ValueError as e:
177dc6
+        except dnsutil.DNSZoneAlreadyExists as e:
177dc6
             if options.force or options.allow_zone_overlap:
177dc6
                 logger.warning('%s', str(e))
177dc6
             else:
177dc6