From e11a78a29e16bc7f34139e486d759ac8156f0208 Mon Sep 17 00:00:00 2001 From: Antonio Torres Date: Wed, 16 Jun 2021 17:41:57 +0200 Subject: [PATCH] dnszone: deprecate option for setting SOA serial MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since IPA 3 [1] SOA serial is managed automatically via autoincrement, and the option of disabling this behavior was deprecated in IPA 3.3.3 [2]. As a result, the option '--serial' during DNS zone addition would be ignored as it is set during the creation. This commit adds a deprecation warning if this option is used. [1]: https://www.freeipa.org/page/V3/DNS_SOA_serial_auto-incrementation [2]: https://www.freeipa.org/page/Releases/3.3.3 Fixes: https://pagure.io/freeipa/issue/8227 Signed-off-by: Antonio Torres Reviewed-By: François Cami Reviewed-By: Rob Crittenden Reviewed-By: Rafael Jeffman --- ipaserver/plugins/dns.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ipaserver/plugins/dns.py b/ipaserver/plugins/dns.py index acb16613c..625073332 100644 --- a/ipaserver/plugins/dns.py +++ b/ipaserver/plugins/dns.py @@ -2432,6 +2432,7 @@ class dnszone(DNSZoneBase): autofill=True, ), Int('idnssoaserial', + # Deprecated cli_name='serial', label=_('SOA serial'), doc=_('SOA record serial number'), @@ -2439,6 +2440,7 @@ class dnszone(DNSZoneBase): maxvalue=4294967295, default_from=_create_zone_serial, autofill=True, + flags=['no_option'], ), Int('idnssoarefresh', cli_name='refresh', @@ -2776,6 +2778,14 @@ class dnszone_add(DNSZoneBase_add): option='ip-address', additional_info=u"Value will be ignored.") ) + if 'idnssoaserial' in options: + messages.add_message( + options['version'], + result, + messages.OptionDeprecatedWarning( + option='idnssoaserial', + additional_info=u"Value will be ignored.") + ) def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options): assert isinstance(dn, DN) @@ -2889,6 +2899,16 @@ class dnszone_mod(DNSZoneBase_mod): doc=_('Force nameserver change even if nameserver not in DNS')), ) + def _warning_deprecated_option(self, result, **options): + if 'idnssoaserial' in options: + messages.add_message( + options['version'], + result, + messages.OptionDeprecatedWarning( + option='idnssoaserial', + additional_info=u"Value will be ignored.") + ) + def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options): if not _check_DN_objectclass(ldap, dn, self.obj.object_class): @@ -2909,6 +2929,7 @@ class dnszone_mod(DNSZoneBase_mod): def execute(self, *keys, **options): result = super(dnszone_mod, self).execute(*keys, **options) + self._warning_deprecated_option(result, **options) self.obj._warning_forwarding(result, **options) self.obj._warning_name_server_option(result, context, **options) self.obj._warning_dnssec_master_is_not_installed(result, **options)