https://fedorahosted.org/freeipa/ticket/5466

Patch attached.
From 94bc97e4509d6942a5176561f17f3eb547469ef4 Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Wed, 18 Nov 2015 19:44:08 +0100
Subject: [PATCH] Make command dns-resolve deprecated.

To debug DNS issues other commands should be used like 'dig', 'host',
'nslookup' instead of command 'ipa dns-resolve'.

This command is executed on server side, what may not be helpful with
debugging clients.

'ipa dns-resolve' command is worse copy of host command, users should use
'host' command instead.

dns-resolve is removed from CLI

https://fedorahosted.org/freeipa/ticket/5466
---
 ipalib/messages.py    | 10 ++++++++++
 ipalib/plugins/dns.py | 17 ++++++++++++++---
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/ipalib/messages.py b/ipalib/messages.py
index 7b4aaf4d85f72df3a27a05f23ee66b01c1e062db..44fee6d1512a8a9fb9f5d90ef090e86d8a7e4b84 100644
--- a/ipalib/messages.py
+++ b/ipalib/messages.py
@@ -311,6 +311,16 @@ class DNSSuspiciousRelativeName(PublicMessage):
     )
 
 
+class CommandDeprecatedWarning(PublicMessage):
+    """
+    **13015** Used when user uses a deprecated option
+    """
+
+    errno = 13015
+    type = "warning"
+    format = _(u"'%(command)s' is deprecated. %(additional_info)s")
+
+
 def iter_messages(variables, base):
     """Return a tuple with all subclasses
     """
diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py
index 68897757e5dba4246689e8431b49880b1645a3ca..6896784b47740a4e73c32adedfd01e0ea3dfd023 100644
--- a/ipalib/plugins/dns.py
+++ b/ipalib/plugins/dns.py
@@ -4180,7 +4180,9 @@ class dnsrecord_find(LDAPSearch):
 
 @register()
 class dns_resolve(Command):
-    __doc__ = _('Resolve a host name in DNS.')
+    __doc__ = _('Resolve a host name in DNS. (Deprecated)')
+
+    NO_CLI = True
 
     has_output = output.standard_value
     msg_summary = _('Found \'%(value)s\'')
@@ -4198,8 +4200,17 @@ class dns_resolve(Command):
             raise errors.NotFound(
                 reason=_('Host \'%(host)s\' not found') % {'host': query}
             )
-
-        return dict(result=True, value=query)
+        result = dict(result=True, value=query)
+        messages.add_message(
+            options['version'], result,
+            messages.CommandDeprecatedWarning(
+                command='dns-resolve',
+                additional_info='The command may return an unexpected result,'
+                                'the resolution of the DNS domain is done on '
+                                'a randomly choosen IPA server.'
+            )
+        )
+        return result
 
 
 @register()
-- 
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