mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Improve dnszone-add error message
Check that NS address passed in dnszone-add is a domain name and not an IP address. Make this clear also the parameter help. https://fedorahosted.org/freeipa/ticket/1567
This commit is contained in:
parent
08905eb9a9
commit
31e4801f30
@ -109,6 +109,7 @@ from ipalib import Flag, Int, List, Str, StrEnum
|
|||||||
from ipalib.plugins.baseldap import *
|
from ipalib.plugins.baseldap import *
|
||||||
from ipalib import _, ngettext
|
from ipalib import _, ngettext
|
||||||
from ipapython import dnsclient
|
from ipapython import dnsclient
|
||||||
|
from ipapython.ipautil import valid_ip
|
||||||
from ldap import explode_dn
|
from ldap import explode_dn
|
||||||
|
|
||||||
# supported resource record types
|
# supported resource record types
|
||||||
@ -318,7 +319,7 @@ class dnszone(LDAPObject):
|
|||||||
Str('idnssoamname',
|
Str('idnssoamname',
|
||||||
cli_name='name_server',
|
cli_name='name_server',
|
||||||
label=_('Authoritative nameserver'),
|
label=_('Authoritative nameserver'),
|
||||||
doc=_('Authoritative nameserver.'),
|
doc=_('Authoritative nameserver domain name'),
|
||||||
),
|
),
|
||||||
Str('idnssoarname',
|
Str('idnssoarname',
|
||||||
cli_name='admin_email',
|
cli_name='admin_email',
|
||||||
@ -431,6 +432,11 @@ class dnszone_add(LDAPCreate):
|
|||||||
# Check nameserver has a forward record
|
# Check nameserver has a forward record
|
||||||
nameserver = entry_attrs['idnssoamname']
|
nameserver = entry_attrs['idnssoamname']
|
||||||
|
|
||||||
|
# NS record must contain domain name
|
||||||
|
if valid_ip(nameserver):
|
||||||
|
raise errors.ValidationError(name='name-server',
|
||||||
|
error=unicode(_("Nameserver address is not a fully qualified domain name")))
|
||||||
|
|
||||||
if not 'ip_address' in options and not options['force']:
|
if not 'ip_address' in options and not options['force']:
|
||||||
is_ns_rec_resolvable(nameserver)
|
is_ns_rec_resolvable(nameserver)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user