dnszone: deprecate option for setting SOA serial

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 <antorres@redhat.com>
Reviewed-By: François Cami <fcami@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Rafael Jeffman <rjeffman@redhat.com>
This commit is contained in:
Antonio Torres 2021-06-16 17:41:57 +02:00
parent bb38fbca91
commit e11a78a29e

View File

@ -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)