mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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
This commit is contained in:
parent
c2034805d3
commit
322458b5b2
@ -2197,6 +2197,8 @@ class dnsrecord(LDAPObject):
|
|||||||
def postprocess_record(self, record, **options):
|
def postprocess_record(self, record, **options):
|
||||||
if options.get('structured', False):
|
if options.get('structured', False):
|
||||||
for attr in record.keys():
|
for attr in record.keys():
|
||||||
|
# attributes in LDAPEntry may not be normalized
|
||||||
|
attr = attr.lower()
|
||||||
try:
|
try:
|
||||||
param = self.params[attr]
|
param = self.params[attr]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
@ -1078,6 +1078,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(
|
dict(
|
||||||
desc='Update global DNS settings',
|
desc='Update global DNS settings',
|
||||||
command=('dnsconfig_mod', [], {'idnsforwarders' : [u'80.142.15.80'],}),
|
command=('dnsconfig_mod', [], {'idnsforwarders' : [u'80.142.15.80'],}),
|
||||||
|
Loading…
Reference in New Issue
Block a user