commit f2bb618fa36c7a80fea62cc4945b166bfb22c130 Author: Florian Best Date: Fri Aug 9 11:01:25 2019 +0200 Bug #49874: prevent CONSTRAINT_VIOLATION if not dnsRecords are set Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/univention/s4connector/__init__.py", line 910, in __sync_file_from_ucs if ((old_dn and not self.sync_from_ucs(key, mapped_object, pre_mapped_ucs_dn, unicode(old_dn, 'utf8'), old, new)) or (not old_dn and not self.sync_from_ucs(key, mapped_object, pre_mapped_ucs_dn, old_dn, old, new))): File "/usr/lib/python2.7/dist-packages/univention/s4connector/s4/__init__.py", line 2520, in sync_from_ucs self.property[property_type].con_sync_function(self, property_type, object) File "/usr/lib/python2.7/dist-packages/univention/s4connector/s4/dns.py", line 1640, in ucs2con s4_host_record_create(s4connector, object) File "/usr/lib/python2.7/dist-packages/univention/s4connector/s4/dns.py", line 959, in s4_host_record_create dnsNodeDn = s4_dns_node_base_create(s4connector, object, dnsRecords) File "/usr/lib/python2.7/dist-packages/univention/s4connector/s4/dns.py", line 904, in s4_dns_node_base_create __create_s4_dns_node(s4connector, dnsNodeDn, relativeDomainNames, dnsRecords) File "/usr/lib/python2.7/dist-packages/univention/s4connector/s4/dns.py", line 507, in __create_s4_dns_node s4connector.lo_s4.lo.add_s(dnsNodeDn, al) File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 210, in add_s return self.result(msgid,all=1,timeout=self.timeout) File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 503, in result resp_type, resp_data, resp_msgid = self.result2(msgid,all,timeout) File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 507, in result2 resp_type, resp_data, resp_msgid, resp_ctrls = self.result3(msgid,all,timeout) File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 514, in result3 resp_ctrl_classes=resp_ctrl_classes File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 521, in result4 ldap_result = self._ldap_call(self._l.result4,msgid,all,timeout,add_ctrls,add_intermediates,add_extop) File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 106, in _ldap_call result = func(*args,**kwargs) CONSTRAINT_VIOLATION: {'info': "attribute 'dnsRecord' on 'DC=n0vg5ew5si,DC=zv3pf30r1a.fzxtw3ascy,CN=MicrosoftDNS,DC=DomainDnsZones,DC=autotest091,DC=local' specified, but with 0 values (illegal)", 'desc': 'Constraint violation'} diff --git a/services/univention-s4-connector/modules/univention/s4connector/s4/dns.py b/services/univention-s4-connector/modules/univention/s4connector/s4/dns.py index 931dcecf92..c7e3bd2f3b 100644 --- a/services/univention-s4-connector/modules/univention/s4connector/s4/dns.py +++ b/services/univention-s4-connector/modules/univention/s4connector/s4/dns.py @@ -500,7 +500,8 @@ def __create_s4_dns_node(s4connector, dnsNodeDn, relativeDomainNames, dnsRecords al.append(('objectClass', ['top', 'dnsNode'])) al.append(('dc', relativeDomainNames)) - al.append(('dnsRecord', dnsRecords)) + if dnsRecords: + al.append(('dnsRecord', dnsRecords)) ud.debug(ud.LDAP, ud.INFO, '__create_s4_dns_node: dn: %s' % dnsNodeDn) ud.debug(ud.LDAP, ud.INFO, '__create_s4_dns_node: al: %s' % al)