diff options
author | talig <talig@amdocs.com> | 2017-09-13 18:16:36 +0300 |
---|---|---|
committer | talig <talig@amdocs.com> | 2017-09-13 18:25:16 +0300 |
commit | 3e805e4880fb799a7e1eac6ac3ee14162fa1e9e6 (patch) | |
tree | 4cf2cbaacb96c96be742804ed002cec21785c096 /openecomp-be/backend/openecomp-sdc-vendor-software-product-manager | |
parent | 45e38d57442499a535f2915aab95a057e106d79f (diff) |
Change healing manager logic
Execute all healers even if one/more have failed.
Turn off vsp old version indication and log healers errors.
This is a temporary solution that would fix non-heat issues only.
Change-Id: I1fbcd3cc33a0520034b3dd373e2cfbe7339c06bd
Issue-ID: SDC-332
Signed-off-by: talig <talig@amdocs.com>
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-software-product-manager')
-rw-r--r-- | openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java index 78c4cbf5d9..c9f4159a4e 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java @@ -38,6 +38,7 @@ import org.openecomp.core.validation.util.MessageContainerUtil; import org.openecomp.sdc.activityLog.ActivityLogManager; import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity; import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.sdc.common.errors.ErrorCategory; import org.openecomp.sdc.common.errors.ErrorCode; import org.openecomp.sdc.common.errors.ValidationErrorBuilder; import org.openecomp.sdc.common.utils.CommonUtil; @@ -136,6 +137,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.Optional; import java.util.Set; import java.util.zip.ZipInputStream; import java.util.zip.ZipOutputStream; @@ -850,7 +852,8 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa : checkout(vspId, user); version.setStatus(VersionStatus.Locked); - healingManager.healAll(getHealingParamsAsMap(vspId, version, user)); + Optional<String> errorMessages = + healingManager.healAll(getHealingParamsAsMap(vspId, version, user)); VspDetails vspDetails = new VspDetails(vspId, version); vspDetails.setOldVersion(null); @@ -858,6 +861,11 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa logger.audit("Healed VSP " + vspDetails.getId()); mdcDataDebugMessage.debugExitMessage("VSP id", vspId); + + if (errorMessages.isPresent()) { + throw new CoreException(new ErrorCode.ErrorCodeBuilder().withId("HEALING_ERROR") + .withCategory(ErrorCategory.APPLICATION).withMessage(errorMessages.get()).build()); + } } private void autoHeal(String vspId, Version checkoutVersion, VspDetails vspDetails, String user) { @@ -865,14 +873,20 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa checkoutVersion.setStatus(VersionStatus.Locked); Map<String, Object> healingParams = getHealingParamsAsMap(vspId, checkoutVersion, user); - healingManager.healAll(healingParams); + + Optional<String> errorMessages = healingManager.healAll(healingParams); + vspDetails.setVersion(checkoutVersion); vspDetails.setOldVersion(null); vspInfoDao.updateOldVersionIndication(vspDetails); logger.audit("Healed VSP " + vspDetails.getName()); - mdcDataDebugMessage.debugExitMessage("VSP id", vspId); + + if (errorMessages.isPresent()) { + throw new CoreException(new ErrorCode.ErrorCodeBuilder().withId("HEALING_ERROR") + .withCategory(ErrorCategory.APPLICATION).withMessage(errorMessages.get()).build()); + } } private Map<String, Object> getHealingParamsAsMap(String vspId, Version version, String user) { |