You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by an...@apache.org on 2021/07/27 08:32:51 UTC

[syncope] branch 2_1_X updated: Incremental pull remediation improvements (#283)

This is an automated email from the ASF dual-hosted git repository.

andreapatricelli pushed a commit to branch 2_1_X
in repository https://gitbox.apache.org/repos/asf/syncope.git


The following commit(s) were added to refs/heads/2_1_X by this push:
     new 5c62e35  Incremental pull remediation improvements (#283)
5c62e35 is described below

commit 5c62e35492cb15e0edeb3c1b100242a476bc8123
Author: Andrea Patricelli <an...@apache.org>
AuthorDate: Tue Jul 27 10:32:45 2021 +0200

    Incremental pull remediation improvements (#283)
    
    * do not stop on first error while pulling in incremental mode
---
 .../java/pushpull/AbstractPullResultHandler.java            | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractPullResultHandler.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractPullResultHandler.java
index 4021560..2d84f06 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractPullResultHandler.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractPullResultHandler.java
@@ -246,9 +246,10 @@ public abstract class AbstractPullResultHandler extends AbstractSyncopeResultHan
                 result.setMessage(ExceptionUtils.getRootCauseMessage(e));
                 LOG.error("Could not create {} {} ", anyTO.getType(), delta.getUid().getUidValue(), e);
                 output = e;
-                resultStatus = Result.FAILURE;
 
                 if (profile.getTask().isRemediation()) {
+                    // set to SUCCESS to let the incremental flow go on in case of errors
+                    resultStatus = Result.SUCCESS;
                     Remediation entity = entityFactory.newEntity(Remediation.class);
                     entity.setAnyType(provision.getAnyType());
                     entity.setOperation(ResourceOperation.CREATE);
@@ -261,6 +262,8 @@ public abstract class AbstractPullResultHandler extends AbstractSyncopeResultHan
                     }
 
                     remediationDAO.save(entity);
+                } else {
+                    resultStatus = Result.FAILURE;
                 }
             }
 
@@ -371,9 +374,11 @@ public abstract class AbstractPullResultHandler extends AbstractSyncopeResultHan
                         LOG.error("Could not update {} {}",
                                 provision.getAnyType().getKey(), delta.getUid().getUidValue(), e);
                         output = e;
-                        resultStatus = Result.FAILURE;
 
                         if (profile.getTask().isRemediation()) {
+                            // set to SUCCESS to let the incremental flow go on in case of errors
+                            resultStatus = Result.SUCCESS;
+
                             Remediation entity = entityFactory.newEntity(Remediation.class);
                             entity.setAnyType(provision.getAnyType());
                             entity.setOperation(ResourceOperation.UPDATE);
@@ -384,6 +389,8 @@ public abstract class AbstractPullResultHandler extends AbstractSyncopeResultHan
                             entity.setPullTask(profile.getTask());
 
                             remediationDAO.save(entity);
+                        } else {
+                            resultStatus = Result.FAILURE;
                         }
                     }
                 }
@@ -673,6 +680,8 @@ public abstract class AbstractPullResultHandler extends AbstractSyncopeResultHan
                         output = e;
 
                         if (profile.getTask().isRemediation()) {
+                            // set to SUCCESS to let the incremental flow go on in case of errors
+                            resultStatus = Result.SUCCESS;
                             Remediation entity = entityFactory.newEntity(Remediation.class);
                             entity.setAnyType(provision.getAnyType());
                             entity.setOperation(ResourceOperation.DELETE);