dnsrecord_add API call allows to use an empty list for aaaarecord and succeessfully adds the IPv4 addresses from arecord list. Using the same to remove the IPv4 addresses again with dnsrecord_del leads to an error.
Adding the IPv4 addresses with:
api.Command["dnsrecord_add"](domain, **{ 'idnsname': host_name, 'arecord': ['192.168.100.100', '192.168.100.101'], 'aaaarecord': [], })
Succeeds, but trying to remove the IPv4 addresses again with dnsrecord_del:
api.Command["dnsrecord_del"](domain, **{ 'idnsname': host_name, 'arecord': ['192.168.100.100', '192.168.100.101'], 'aaaarecord': [], })
Fails with:
AttrValueNotFound("AAAA record does not contain 'None'",)
Fails to remove the IPv4 addresses
Removes IPv4 addresses
Fails on RHEL-7: ipa-server-4.6.4-10.el7.centos.3.x86_64 ipa-client-4.6.4-10.el7.centos.3.x86_64 389-ds-base-1.3.8.4-23.el7_6.x86_64 pki-ca-10.5.9-13.el7_6.noarch krb5-server-1.15.1-37.el7_6.x86_64
Also on RHEL-8.1: ipa-server-4.8.0-11.module+el8.1.0+4247+9f3fd721.x86_64 ipa-client-4.8.0-11.module+el8.1.0+4247+9f3fd721.x86_64 389-ds-base-1.4.1.3-7.module+el8.1.0+4150+5b8c2c1f.x86_64 pki-ca-10.7.3-1.module+el8.1.0+3964+500fc130.noarch krb5-server-1.17-9.el8.x86_64
I looked into the issue. dnsrecord_del constructs an ipaldap.LDAPEntry object from the arguments:
dnsrecord_del
ipaldap.LDAPEntry
LDAPEntry(ipapython.dn.DN('idnsname=test,idnsname=ipa.example.,cn=dns,dc=ipa,dc=example'), {'arecord': ['192.168.100.100', '192.168.100.101'], 'aaaarecord': []})
The dnsrecord_del.pre_callback method loops over the record types and eventually calls entry_attr['aaaarecord']. Internally the LDAPEntry class maps an entry with an empty list to None:
dnsrecord_del.pre_callback
entry_attr['aaaarecord']
None
(Pdb) p entry_attrs['aaaarecord'] None
Since None is neither a tuple nor a list, the loop then creates a list [None].
[None]
master:
ipa-4-8:
Metadata Update from @abbra: - Issue close_status updated to: fixed - Issue status updated to: Closed (was: Open)
Login to comment on this ticket.