Testing if address is resolvable can be done by directly call of is_host_resovable, instead of call the dns-resolve command which is doing the same (works as proxy).

Patch attached.
From 19914a0196da6522d75a74ca7f8a196ed2616d7a Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Wed, 18 Nov 2015 19:25:04 +0100
Subject: [PATCH] Call directly function is_host_resolvable instead do call via
 framework

---
 ipalib/plugins/dns.py | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py
index 901afbb7ac619ee6f25d38808b4c9a7b6cdef112..919592b8faf627774326b3c756794b588a5706b5 100644
--- a/ipalib/plugins/dns.py
+++ b/ipalib/plugins/dns.py
@@ -1563,9 +1563,7 @@ def check_ns_rec_resolvable(zone, name):
     elif not name.is_absolute():
         # this is a DNS name relative to the zone
         name = name.derelativize(zone.make_absolute())
-    try:
-        return api.Command['dns_resolve'](unicode(name))
-    except errors.NotFound:
+    if not is_host_resolvable(name):
         raise errors.NotFound(
             reason=_('Nameserver \'%(host)s\' does not have a corresponding '
                      'A/AAAA record') % {'host': name}
-- 
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