py3: DNS: get_record_entry_attrs: do not modify dict during iteration

In py3 keys() doesn't return list but iterator so it must be transformed
to tuple otherwise iterator will be broken.

https://fedorahosted.org/freeipa/ticket/4985

Reviewed-By: Jan Cholasta <jcholast@redhat.com>
This commit is contained in:
Martin Basti 2017-01-26 10:25:46 +01:00 committed by Jan Cholasta
parent a3d3b0ad25
commit 03d0a55e8a

View File

@ -3195,7 +3195,7 @@ class dnsrecord(LDAPObject):
def get_record_entry_attrs(self, entry_attrs):
entry_attrs = entry_attrs.copy()
for attr in entry_attrs.keys():
for attr in tuple(entry_attrs.keys()):
if attr not in self.params or self.params[attr].primary_key:
del entry_attrs[attr]
return entry_attrs