|
Lines 2396-2401
Link Here
|
| 2396 |
ud.debug(ud.LDAP, ud.INFO, "sync_from_ucs: new_object: %s" % new_ucs_object) |
2396 |
ud.debug(ud.LDAP, ud.INFO, "sync_from_ucs: new_object: %s" % new_ucs_object) |
| 2397 |
object['old_ucs_object'] = old_ucs_object |
2397 |
object['old_ucs_object'] = old_ucs_object |
| 2398 |
object['new_ucs_object'] = new_ucs_object |
2398 |
object['new_ucs_object'] = new_ucs_object |
|
|
2399 |
try: |
| 2400 |
current_ucs_object = self.lo.get(object['dn']) |
| 2401 |
object['current_ucs_object'] = current_ucs_object |
| 2402 |
except ldap.NO_SUCH_OBJECT: |
| 2403 |
pass |
| 2404 |
|
| 2399 |
attribute_list = set(old_ucs_object.keys()).union(set(new_ucs_object.keys())) |
2405 |
attribute_list = set(old_ucs_object.keys()).union(set(new_ucs_object.keys())) |
| 2400 |
if hasattr(self.property[property_type],"con_sync_function"): |
2406 |
if hasattr(self.property[property_type],"con_sync_function"): |
| 2401 |
self.property[property_type].con_sync_function(self, property_type, object) |
2407 |
self.property[property_type].con_sync_function(self, property_type, object) |
|
Lines 2438-2446
Link Here
|
| 2438 |
modify=True |
2444 |
modify=True |
| 2439 |
|
2445 |
|
| 2440 |
if not modify: |
2446 |
if not modify: |
| 2441 |
ud.debug(ud.LDAP, ud.INFO, "sync_from_ucs: no modification necessary for %s" % attribute) |
2447 |
ud.debug(ud.LDAP, ud.INFO, "sync_from_ucs: values did not change for %s" % attribute) |
| 2442 |
continue |
2448 |
continue |
| 2443 |
|
2449 |
|
|
|
2450 |
current_s4_values = set(s4_object.get(s4_attribute, [])) |
| 2451 |
ud.debug(ud.LDAP, ud.INFO, "sync_from_ucs: The current S4 values: %s" % current_s4_values) |
| 2452 |
|
| 2453 |
if 'current_ucs_object' in object: |
| 2454 |
current_values = set(object['current_ucs_object'].get(attribute, [])) |
| 2455 |
ud.debug(ud.LDAP, ud.INFO, "sync_from_ucs: cur_values: %s" % current_values) |
| 2456 |
if current_values == current_s4_values: |
| 2457 |
ud.debug(ud.LDAP, ud.INFO, "sync_from_ucs: no modification necessary for %s" % attribute) |
| 2458 |
continue |
| 2459 |
|
| 2444 |
# So, at this point we have the old and the new UCS object. |
2460 |
# So, at this point we have the old and the new UCS object. |
| 2445 |
# Thus we can create the diff, but we have to check the current S4 object |
2461 |
# Thus we can create the diff, but we have to check the current S4 object |
| 2446 |
|
2462 |
|
|
Lines 2456-2464
Link Here
|
| 2456 |
|
2472 |
|
| 2457 |
if s4_other_attribute: |
2473 |
if s4_other_attribute: |
| 2458 |
# in this case we need lists because sets are unorded and the order is important |
2474 |
# in this case we need lists because sets are unorded and the order is important |
| 2459 |
current_s4_values = set(s4_object.get(s4_attribute, [])) |
|
|
| 2460 |
ud.debug(ud.LDAP, ud.INFO, "sync_from_ucs: The current S4 values: %s" % current_s4_values) |
| 2461 |
|
| 2462 |
current_s4_other_values = set(s4_object.get(s4_other_attribute, [])) |
2475 |
current_s4_other_values = set(s4_object.get(s4_other_attribute, [])) |
| 2463 |
ud.debug(ud.LDAP, ud.INFO, "sync_from_ucs: The current S4 other values: %s" % current_s4_other_values) |
2476 |
ud.debug(ud.LDAP, ud.INFO, "sync_from_ucs: The current S4 other values: %s" % current_s4_other_values) |
| 2464 |
|
2477 |
|
|
Lines 2480-2489
Link Here
|
| 2480 |
if current_s4_other_values != new_s4_other_values: |
2493 |
if current_s4_other_values != new_s4_other_values: |
| 2481 |
modlist.append((ldap.MOD_REPLACE, s4_other_attribute, new_s4_other_values)) |
2494 |
modlist.append((ldap.MOD_REPLACE, s4_other_attribute, new_s4_other_values)) |
| 2482 |
else: |
2495 |
else: |
| 2483 |
current_s4_values = set(s4_object.get(s4_attribute, [])) |
|
|
| 2484 |
|
| 2485 |
ud.debug(ud.LDAP, ud.INFO, "sync_from_ucs: The current S4 values: %s" % current_s4_values) |
| 2486 |
|
| 2487 |
if (to_add or to_remove) and attribute_type[attribute].single_value: |
2496 |
if (to_add or to_remove) and attribute_type[attribute].single_value: |
| 2488 |
modify=False |
2497 |
modify=False |
| 2489 |
if not current_s4_values or not value: |
2498 |
if not current_s4_values or not value: |