mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Add warning about semantic change for zones
--forwarder have different semantic since forward zones support. Add warning if zone contains forwarders. Ticket: https://fedorahosted.org/freeipa/ticket/3210#comment:16 Reviewed-By: Petr Spacek <pspacek@redhat.com>
This commit is contained in:
committed by
Petr Viktorin
parent
3b310d6b4f
commit
33cf958b98
@@ -135,6 +135,18 @@ class VersionMissing(PublicMessage):
|
||||
"guaranteed. Assuming server's API version, %(server_version)s")
|
||||
|
||||
|
||||
class ForwardersWarning(PublicMessage):
|
||||
"""
|
||||
**13002** Used when (master) zone contains forwarders
|
||||
"""
|
||||
|
||||
errno = 13002
|
||||
type = 'warning'
|
||||
format = _(
|
||||
u"DNS forwarder semantics changed since IPA 4.0.\n"
|
||||
u"You may want to use forward zones (dnsforwardzone-*) instead.\n"
|
||||
u"For more details read the docs.")
|
||||
|
||||
def iter_messages(variables, base):
|
||||
"""Return a tuple with all subclasses
|
||||
"""
|
||||
|
||||
@@ -32,11 +32,13 @@ import encodings.idna
|
||||
from ipalib.request import context
|
||||
from ipalib import api, errors, output
|
||||
from ipalib import Command
|
||||
from ipalib.capabilities import VERSION_WITHOUT_CAPABILITIES
|
||||
from ipalib.parameters import (Flag, Bool, Int, Decimal, Str, StrEnum, Any,
|
||||
DeprecatedParam, DNSNameParam)
|
||||
from ipalib.plugable import Registry
|
||||
from ipalib.plugins.baseldap import *
|
||||
from ipalib import _, ngettext
|
||||
from ipalib import messages
|
||||
from ipalib.util import (validate_zonemgr, normalize_zonemgr,
|
||||
get_dns_forward_zone_update_policy,
|
||||
get_dns_reverse_zone_update_policy,
|
||||
@@ -268,6 +270,7 @@ _output_permissions = (
|
||||
output.Output('value', unicode, _('Permission value')),
|
||||
)
|
||||
|
||||
|
||||
def _rname_validator(ugettext, zonemgr):
|
||||
try:
|
||||
validate_zonemgr(zonemgr)
|
||||
@@ -2221,6 +2224,11 @@ class dnszone(DNSZoneBase):
|
||||
return
|
||||
_records_idn_postprocess(record, **options)
|
||||
|
||||
def _warning_forwarding(self, result, **options):
|
||||
if ('idnsforwarders' in result['result']):
|
||||
messages.add_message(options.get('version', VERSION_WITHOUT_CAPABILITIES),
|
||||
result, messages.ForwardersWarning())
|
||||
|
||||
|
||||
|
||||
@register()
|
||||
@@ -2309,6 +2317,11 @@ class dnszone_add(DNSZoneBase_add):
|
||||
entry_attrs['idnssoamname'] = nameserver
|
||||
return dn
|
||||
|
||||
def execute(self, *keys, **options):
|
||||
result = super(dnszone_add, self).execute(*keys, **options)
|
||||
self.obj._warning_forwarding(result, **options)
|
||||
return result
|
||||
|
||||
def post_callback(self, ldap, dn, entry_attrs, *keys, **options):
|
||||
assert isinstance(dn, DN)
|
||||
nameserver_ip_address = options.get('ip_address')
|
||||
@@ -2386,6 +2399,11 @@ class dnszone_mod(DNSZoneBase_mod):
|
||||
|
||||
return dn
|
||||
|
||||
def execute(self, *keys, **options):
|
||||
result = super(dnszone_mod, self).execute(*keys, **options)
|
||||
self.obj._warning_forwarding(result, **options)
|
||||
return result
|
||||
|
||||
def post_callback(self, ldap, dn, entry_attrs, *keys, **options):
|
||||
assert isinstance(dn, DN)
|
||||
self.obj._rr_zone_postprocess(entry_attrs, **options)
|
||||
@@ -2434,6 +2452,11 @@ class dnszone_find(DNSZoneBase_find):
|
||||
class dnszone_show(DNSZoneBase_show):
|
||||
__doc__ = _('Display information about a DNS zone (SOA record).')
|
||||
|
||||
def execute(self, *keys, **options):
|
||||
result = super(dnszone_show, self).execute(*keys, **options)
|
||||
self.obj._warning_forwarding(result, **options)
|
||||
return result
|
||||
|
||||
def post_callback(self, ldap, dn, entry_attrs, *keys, **options):
|
||||
assert isinstance(dn, DN)
|
||||
self.obj._rr_zone_postprocess(entry_attrs, **options)
|
||||
|
||||
Reference in New Issue
Block a user