diff options
author | Martin Kosek <mkosek@redhat.com> | 2013-03-21 14:54:46 +0100 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2013-03-22 15:10:03 +0100 |
commit | 322458b5b2f80e179ef43b904c2665254c0a3763 (patch) | |
tree | 5f912b4ac420871e849e65d955959939d92a3153 | |
parent | c2034805d323dcf505042d03dbd801561aa64ed3 (diff) | |
download | freeipa-322458b5b2f80e179ef43b904c2665254c0a3763.tar.gz freeipa-322458b5b2f80e179ef43b904c2665254c0a3763.tar.xz freeipa-322458b5b2f80e179ef43b904c2665254c0a3763.zip |
Fix structured DNS record output
Recent LDAP refactoring replaced entry_attrs regular dict with
normalized keys (i.e. lowercase) with LDAPEntry instance which keys
may not be normalized. This broke CND command output when
--structured and --all options were used.
Force lowercase normalization of the LDAPEntry keys in DNS plugin
structured format postprocessing. Also add a missing test for
DNS record structured output.
https://fedorahosted.org/freeipa/ticket/3526
-rw-r--r-- | ipalib/plugins/dns.py | 2 | ||||
-rw-r--r-- | tests/test_xmlrpc/test_dns_plugin.py | 28 |
2 files changed, 30 insertions, 0 deletions
diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py index a23d1b823..dabab8405 100644 --- a/ipalib/plugins/dns.py +++ b/ipalib/plugins/dns.py @@ -2197,6 +2197,8 @@ class dnsrecord(LDAPObject): def postprocess_record(self, record, **options): if options.get('structured', False): for attr in record.keys(): + # attributes in LDAPEntry may not be normalized + attr = attr.lower() try: param = self.params[attr] except KeyError: diff --git a/tests/test_xmlrpc/test_dns_plugin.py b/tests/test_xmlrpc/test_dns_plugin.py index 190248494..945bca384 100644 --- a/tests/test_xmlrpc/test_dns_plugin.py +++ b/tests/test_xmlrpc/test_dns_plugin.py @@ -1079,6 +1079,34 @@ class test_dns(Declarative): ), dict( + desc='Show record %r in zone %r with --structured and --all options'\ + % (dnsrev1, revdnszone1), + command=('dnsrecord_show', [revdnszone1, dnsrev1], + {'structured': True, 'all': True}), + expected={ + 'value': dnsrev1, + 'summary': None, + 'result': { + 'dn': dnsrev1_dn, + 'idnsname': [dnsrev1], + 'objectclass': objectclasses.dnsrecord, + 'dnsrecords': [ + { + 'dnstype': u'PTR', + 'dnsdata': u'foo-1.example.com.', + 'ptr_part_hostname': u'foo-1.example.com.' + }, + { + 'dnstype': u'CNAME', + 'dnsdata': u'foo-1.example.com.', + 'cname_part_hostname': u'foo-1.example.com.' + } + ], + }, + }, + ), + + dict( desc='Update global DNS settings', command=('dnsconfig_mod', [], {'idnsforwarders' : [u'80.142.15.80'],}), expected={ |