diff options
author | Martin Kosek <mkosek@redhat.com> | 2011-07-13 14:01:17 +0200 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2011-07-13 15:06:13 +0200 |
commit | 0cb65fd9f6865d606625ddb16206090779462c1f (patch) | |
tree | 6a100a1362a12eba6aa1e0b8cec62f33b6f4accd /ipalib | |
parent | b93e0b8bbfaa1e9252b3d096ef9251493654dec2 (diff) | |
download | freeipa-0cb65fd9f6865d606625ddb16206090779462c1f.tar.gz freeipa-0cb65fd9f6865d606625ddb16206090779462c1f.tar.xz freeipa-0cb65fd9f6865d606625ddb16206090779462c1f.zip |
Filter reverse zones in dnszone-find
Implements a new option to filter out reverse zones.
This patch also do some clean up in dns plugin - debug prints were
accidentally left here in the last dns patch.
https://fedorahosted.org/freeipa/ticket/1471
Diffstat (limited to 'ipalib')
-rw-r--r-- | ipalib/plugins/dns.py | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py index 5c990ace1..e7a0a05a3 100644 --- a/ipalib/plugins/dns.py +++ b/ipalib/plugins/dns.py @@ -458,6 +458,25 @@ class dnszone_find(LDAPSearch): Search for DNS zones (SOA records). """ + takes_options = LDAPSearch.takes_options + ( + Flag('forward_only', + label=_('Forward zones only'), + cli_name='forward_only', + doc=_('Search for forward zones only'), + ), + ) + + def pre_callback(self, ldap, filter, attrs_list, base_dn, scope, *args, **options): + if options.get('forward_only', False): + search_kw = {} + search_kw['idnsname'] = _valid_reverse_zones.keys() + rev_zone_filter = ldap.make_filter(search_kw, rules=ldap.MATCH_NONE, exact=False, + trailing_wildcard=False) + filter = ldap.combine_filters((rev_zone_filter, filter), rules=ldap.MATCH_ALL) + + return (filter, base_dn, scope) + + api.register(dnszone_find) @@ -823,8 +842,6 @@ class dnsrecord_mod(dnsrecord_mod_record): old_entry_attrs.setdefault(a, []) if v or v is None: # overwrite the old entry old_entry_attrs[a] = v - print "DNSRECORD_MOD::update_old_entry_callback: old:", old_entry_attrs - print "DNSRECORD_MOD::update_old_entry_callback: new:", entry_attrs def record_options_2_entry(self, **options): entries = dict((t, options.get(t, [])) for t in _record_attributes) @@ -835,12 +852,10 @@ class dnsrecord_mod(dnsrecord_mod_record): rtype_cb = '_%s_pre_callback' % rtype if hasattr(self.obj, rtype_cb): dn = getattr(self.obj, rtype_cb)(ldap, dn, entry_attrs, *keys, **options) - print "DNSRECORD_MOD::pre_callback: rtype_cb:", rtype_cb return dn def post_callback(self, keys, entry_attrs): - print "DNSRECORD_MOD::post_callback:", entry_attrs if not self.obj.is_pkey_zone_record(*keys): for a in _record_attributes: if a in entry_attrs and entry_attrs[a]: |