pgreco / rpms / ipa

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

Blame SOURCES/0133-Catch-DNS-exceptions-during-emptyzones-named.conf-up.patch

403b09
From bbc716fa6c58305e81962ea9f7e7e710ff51ad99 Mon Sep 17 00:00:00 2001
403b09
From: Martin Basti <mbasti@redhat.com>
403b09
Date: Tue, 13 Sep 2016 19:12:40 +0200
403b09
Subject: [PATCH] Catch DNS exceptions during emptyzones named.conf upgrade
403b09
403b09
For some reasons named may not be runnig and this cause fail of this
403b09
upgrade step. This step is not critical so only ERROR message with
403b09
recommendation is shown.
403b09
403b09
https://fedorahosted.org/freeipa/ticket/6205
403b09
403b09
Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
403b09
---
403b09
 ipaserver/install/server/upgrade.py | 17 ++++++++++++++---
403b09
 1 file changed, 14 insertions(+), 3 deletions(-)
403b09
403b09
diff --git a/ipaserver/install/server/upgrade.py b/ipaserver/install/server/upgrade.py
403b09
index e1343f423cec21f02e3d9581012496baa7b30cc6..3b23c2e688f436453cfa185f87780b7ff5cafa16 100644
403b09
--- a/ipaserver/install/server/upgrade.py
403b09
+++ b/ipaserver/install/server/upgrade.py
403b09
@@ -11,6 +11,8 @@ import pwd
403b09
 import fileinput
403b09
 import sys
403b09
 
403b09
+import dns.exception
403b09
+
403b09
 import six
403b09
 from six.moves.configparser import SafeConfigParser
403b09
 
403b09
@@ -840,9 +842,18 @@ def named_update_global_forwarder_policy():
403b09
         'forward_policy_conflict_with_empty_zones_handled',
403b09
         True
403b09
     )
403b09
-    if not dnsutil.has_empty_zone_addresses(api.env.host):
403b09
-        # guess: local server does not have IP addresses from private ranges
403b09
-        # so hopefully automatic empty zones are not a problem
403b09
+    try:
403b09
+        if not dnsutil.has_empty_zone_addresses(api.env.host):
403b09
+            # guess: local server does not have IP addresses from private
403b09
+            # ranges so hopefully automatic empty zones are not a problem
403b09
+            return False
403b09
+    except dns.exception.DNSException as ex:
403b09
+        root_logger.error(
403b09
+            'Skipping update of global DNS forwarder in named.conf: '
403b09
+            'Unable to determine if local server is using an '
403b09
+            'IP address belonging to an automatic empty zone. '
403b09
+            'Consider changing forwarding policy to "only". '
403b09
+            'DNS exception: %s', ex)
403b09
         return False
403b09
 
403b09
     if bindinstance.named_conf_get_directive(
403b09
-- 
403b09
2.7.4
403b09