diff --git a/ipalib/messages.py b/ipalib/messages.py index 7b4aaf4d8..44fee6d15 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 02044d1e0..7bbb092c8 100644 --- a/ipalib/plugins/dns.py +++ b/ipalib/plugins/dns.py @@ -4182,7 +4182,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\'') @@ -4204,8 +4206,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 chosen IPA server.' + ) + ) + return result @register()