diff options
author | Jan Cholasta <jcholast@redhat.com> | 2012-01-16 09:21:50 -0500 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2012-03-28 14:03:27 +0200 |
commit | 5a55e11a2540b9fa7c0af04b375d9bdaf277642d (patch) | |
tree | 35bf773c74325ab2da55d8bb8b94bf0fd11d6536 /ipalib/plugins/dns.py | |
parent | 9bb1e6c03edf917178f2e1bdf395735e1b17ad1f (diff) | |
download | freeipa-5a55e11a2540b9fa7c0af04b375d9bdaf277642d.tar.gz freeipa-5a55e11a2540b9fa7c0af04b375d9bdaf277642d.tar.xz freeipa-5a55e11a2540b9fa7c0af04b375d9bdaf277642d.zip |
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
Diffstat (limited to 'ipalib/plugins/dns.py')
-rw-r--r-- | ipalib/plugins/dns.py | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py index aea04b40d..24b8357a4 100644 --- a/ipalib/plugins/dns.py +++ b/ipalib/plugins/dns.py @@ -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) |