Lines 167-184
def dns_dn_mapping(s4connector, given_object, dn_mapping_stored, isUCSobject):
|
Link Here
|
---|
|
167 |
exploded_dn = ldap.dn.str2dn(unicode_to_utf8(dn)) |
167 |
exploded_dn = ldap.dn.str2dn(unicode_to_utf8(dn)) |
168 |
(fst_rdn_attribute_utf8, fst_rdn_value_utf8, _flags) = exploded_dn[0][0] |
168 |
(fst_rdn_attribute_utf8, fst_rdn_value_utf8, _flags) = exploded_dn[0][0] |
169 |
|
169 |
|
|
|
170 |
attributes_from_dn = {attr: value for rdn in exploded_dn |
171 |
for (attr, value, _flags) in rdn} |
172 |
|
170 |
if isUCSobject: |
173 |
if isUCSobject: |
171 |
ud.debug(ud.LDAP, ud.INFO, "dns_dn_mapping: got an UCS-Object") |
174 |
ud.debug(ud.LDAP, ud.INFO, "dns_dn_mapping: got an UCS-Object") |
172 |
# lookup the relativeDomainName as DC/dnsNode in S4 to get corresponding DN, if not found create new |
175 |
# lookup the relativeDomainName as DC/dnsNode in S4 to get corresponding DN, if not found create new |
173 |
|
176 |
|
174 |
try: |
177 |
try: |
175 |
relativeDomainName = obj['attributes'][ol_RR_attr][0] |
178 |
relativeDomainName = attributes_from_dn[ol_RR_attr] |
176 |
except (KeyError, IndexError): |
179 |
except KeyError: |
177 |
# Safety fallback for the unexpected case, where relativeDomainName would not be set |
180 |
try: |
178 |
if 'zoneName' == fst_rdn_attribute_utf8: |
181 |
relativeDomainName = obj['attributes'][ol_RR_attr][0] |
179 |
relativeDomainName = '@' |
182 |
except (KeyError, IndexError): |
180 |
else: |
183 |
# Safety fallback for the unexpected case, where relativeDomainName would not be set |
181 |
raise # can't determine relativeDomainName |
184 |
if 'zoneName' == fst_rdn_attribute_utf8: |
|
|
185 |
relativeDomainName = '@' |
186 |
else: |
187 |
raise # can't determine relativeDomainName |
182 |
|
188 |
|
183 |
if s4connector.property[propertyname].mapping_table and propertyattrib in s4connector.property[propertyname].mapping_table.keys(): |
189 |
if s4connector.property[propertyname].mapping_table and propertyattrib in s4connector.property[propertyname].mapping_table.keys(): |
184 |
for ucsval, conval in s4connector.property[propertyname].mapping_table[propertyattrib]: |
190 |
for ucsval, conval in s4connector.property[propertyname].mapping_table[propertyattrib]: |
Lines 191-205
def dns_dn_mapping(s4connector, given_object, dn_mapping_stored, isUCSobject):
|
Link Here
|
---|
|
191 |
pass # values are not the same codec |
197 |
pass # values are not the same codec |
192 |
|
198 |
|
193 |
try: |
199 |
try: |
|
|
200 |
ol_zone_name = attributes_from_dn['zoneName'] |
201 |
except KeyError: |
202 |
# let exceptions pass through, we have no other fallback |
194 |
ol_zone_name = obj['attributes']['zoneName'][0] |
203 |
ol_zone_name = obj['attributes']['zoneName'][0] |
195 |
except (KeyError, IndexError): |
|
|
196 |
# Safety fallback for the unexpected case, where zoneName would not be set |
197 |
if ol_RR_attr == fst_rdn_attribute_utf8: |
198 |
(snd_rdn_attribute_utf8, snd_rdn_value_utf8, _flags) = exploded_dn[1][0] |
199 |
if 'zoneName' == snd_rdn_attribute_utf8: |
200 |
ol_zone_name = snd_rdn_value_utf8 |
201 |
else: |
202 |
raise # can't determine zoneName for this relativeDomainName |
203 |
|
204 |
|
204 |
target_RR_val = relativeDomainName |
205 |
target_RR_val = relativeDomainName |
205 |
target_zone_name = ol_zone_name |
206 |
target_zone_name = ol_zone_name |
206 |
- |
|
|
207 |
-- |
208 |
test/ucs-test/tests/52_s4connector/175sync_create_dns_a_record | 2 ++ |
207 |
test/ucs-test/tests/52_s4connector/175sync_create_dns_a_record | 2 ++ |
209 |
test/ucs-test/tests/52_s4connector/175sync_create_dns_aaaa_record | 2 ++ |
208 |
test/ucs-test/tests/52_s4connector/175sync_create_dns_aaaa_record | 2 ++ |
210 |
test/ucs-test/tests/52_s4connector/175sync_create_dns_alias | 2 ++ |
209 |
test/ucs-test/tests/52_s4connector/175sync_create_dns_alias | 2 ++ |
211 |
.../tests/52_s4connector/175sync_create_dns_msdcs_record_con2ucs | 2 ++ |
210 |
.../tests/52_s4connector/175sync_create_dns_msdcs_record_con2ucs | 2 ++ |
212 |
.../tests/52_s4connector/175sync_create_dns_msdcs_record_ucs2con | 2 ++ |
211 |
.../tests/52_s4connector/175sync_create_dns_msdcs_record_ucs2con | 2 ++ |
213 |
test/ucs-test/tests/52_s4connector/175sync_create_dns_pointer_record | 2 ++ |
212 |
test/ucs-test/tests/52_s4connector/175sync_create_dns_pointer_record | 2 ++ |
214 |
test/ucs-test/tests/52_s4connector/175sync_create_dns_serial | 2 ++ |
213 |
test/ucs-test/tests/52_s4connector/175sync_create_dns_serial | 2 ++ |
215 |
test/ucs-test/tests/52_s4connector/175sync_create_dns_service_record | 2 ++ |
214 |
test/ucs-test/tests/52_s4connector/175sync_create_dns_service_record | 2 ++ |
216 |
test/ucs-test/tests/52_s4connector/175sync_create_dns_ttl | 2 ++ |
215 |
test/ucs-test/tests/52_s4connector/175sync_create_dns_ttl | 2 ++ |
217 |
test/ucs-test/tests/52_s4connector/175sync_create_dns_txt | 2 ++ |
216 |
test/ucs-test/tests/52_s4connector/175sync_create_dns_txt | 2 ++ |
218 |
test/ucs-test/tests/52_s4connector/175sync_create_dns_wildcard_host | 2 ++ |
217 |
test/ucs-test/tests/52_s4connector/175sync_create_dns_wildcard_host | 2 ++ |
219 |
11 files changed, 22 insertions(+) |
218 |
11 files changed, 22 insertions(+) |