Issue #51 has been updated by Jonathan Clarke.

Status changed from Feedback to Closed

This fix seems good. Thomas and I have done some testing, and we haven't seen 
heard anything bad. Closing the issue.
----------------------------------------
Bug #51: condition are tested after modifications are calculated
http://tools.lsc-project.org/issues/show/51

Author: Thomas Chemineau
Status: Closed
Priority: Normal
Assigned to: Thomas Chemineau
Category: Core
Target version: 1.1


Well, this is definitely a bug :)

If in lsc.properties I put something like the following :

<pre>
lsc.tasks.myTask.condition.update = 
StringUtils.startsWith(srcBean.getAttributeValueById("userPassword"),"tes")
lsc.syncoptions.myTask.userPassword.force_value = "{SHA}" + 
StringUtils.hash(StringUtils.HASH_SHA1, 
srcBean.getAttributeValueById("userPassword"))
</pre>

I get this log :

<pre>
384  [main] DEBUG  
org.lsc.AbstractSynchronize.synchronize2Ldap(AbstractSynchronize.java:295)   - 
Synchronizing org.lsc.objects.brinksUtilisateur for 
uid=elilly,ou=utilisateurs,dc=brinks,dc=fr
418  [main] DEBUG  
org.lsc.beans.BeanComparator.getModifyEntry(BeanComparator.java:284)   - Do 
nothing (userpasswordsyncwith)
419  [main] DEBUG  
org.lsc.beans.BeanComparator.getModifyEntry(BeanComparator.java:318)   - 
Modifying entry "uid=elilly,ou=utilisateurs"
#### DEBUG #### {SHA}nU4eI71bcnBGqeO0t9tXvY1u5oQ= and tes
#### DEBUG #### false
432  [main] DEBUG  
org.lsc.AbstractSynchronize.logShouldAction(AbstractSynchronize.java:489)   - 
Update condition false. Should have modified object 
uid=elilly,ou=utilisateurs,dc=brinks,dc=fr
dn: uid=elilly,ou=utilisateurs,dc=brinks,dc=fr
changetype: modify
replace: userpassword
userpassword: {SHA}nU4eI71bcnBGqeO0t9tXvY1u5oQ=
</pre>

Well, you see, conditions will be tested on modified values.

In code, a condition is tested after creating the modification object. In fact, 
this is because we would like to print modifications that could be applied on 
the destination repository if the condition was true. Maybe could we calculate 
modifications, after testing conditions, and skip those if false. But, if an 
option is passed to LSC, at the execution time, LSC will calculate 
modifications and printing them before skipping (could be usefull for log).

An idea ?



-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://tools.lsc-project.org/my/account
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://lists.lsc-project.org/pipermail/lsc-dev/attachments/20090601/a0fd8c97/attachment-0001.htm>

Reply via email to