mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Fix the procedure for getting default values of command parameters.
The parameters used in default_from of other parameters are now properly validated before the default_from is called. ticket 1847
This commit is contained in:
committed by
Martin Kosek
parent
9bb1e6c03e
commit
5a55e11a25
@@ -1694,13 +1694,6 @@ class dnszone_add(LDAPCreate):
|
||||
),
|
||||
)
|
||||
|
||||
def args_options_2_params(self, *args, **options):
|
||||
# FIXME: Check if name_from_ip is valid. The framework should do that,
|
||||
# but it does not. Before it's fixed, this should suffice.
|
||||
if 'name_from_ip' in options:
|
||||
self.obj.params['name_from_ip'](unicode(options['name_from_ip']))
|
||||
return super(dnszone_add, self).args_options_2_params(*args, **options)
|
||||
|
||||
def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):
|
||||
if not dns_container_exists(self.api.Backend.ldap2):
|
||||
raise errors.NotFound(reason=_('DNS is not configured'))
|
||||
@@ -1747,13 +1740,6 @@ api.register(dnszone_del)
|
||||
class dnszone_mod(LDAPUpdate):
|
||||
__doc__ = _('Modify DNS zone (SOA record).')
|
||||
|
||||
def args_options_2_params(self, *args, **options):
|
||||
# FIXME: Check if name_from_ip is valid. The framework should do that,
|
||||
# but it does not. Before it's fixed, this should suffice.
|
||||
if 'name_from_ip' in options:
|
||||
self.obj.params['name_from_ip'](unicode(options['name_from_ip']))
|
||||
return super(dnszone_mod, self).args_options_2_params(*args, **options)
|
||||
|
||||
api.register(dnszone_mod)
|
||||
|
||||
|
||||
@@ -1761,8 +1747,12 @@ class dnszone_find(LDAPSearch):
|
||||
__doc__ = _('Search for DNS zones (SOA records).')
|
||||
|
||||
def args_options_2_params(self, *args, **options):
|
||||
# FIXME: Check if name_from_ip is valid. The framework should do that,
|
||||
# but it does not. Before it's fixed, this should suffice.
|
||||
# FIXME: Check that name_from_ip is valid. This is necessary because
|
||||
# custom validation rules, including _validate_ipnet, are not
|
||||
# used when doing a search. Once we have a parameter type for
|
||||
# IP network objects, this will no longer be necessary, as the
|
||||
# parameter type will handle the validation itself (see
|
||||
# <https://fedorahosted.org/freeipa/ticket/2266>).
|
||||
if 'name_from_ip' in options:
|
||||
self.obj.params['name_from_ip'](unicode(options['name_from_ip']))
|
||||
return super(dnszone_find, self).args_options_2_params(*args, **options)
|
||||
|
||||
Reference in New Issue
Block a user