From 3e805e4880fb799a7e1eac6ac3ee14162fa1e9e6 Mon Sep 17 00:00:00 2001 From: talig Date: Wed, 13 Sep 2017 18:16:36 +0300 Subject: 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 --- .../impl/VendorSoftwareProductManagerImpl.java | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'openecomp-be/backend/openecomp-sdc-vendor-software-product-manager') 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 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 healingParams = getHealingParamsAsMap(vspId, checkoutVersion, user); - healingManager.healAll(healingParams); + + Optional 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 getHealingParamsAsMap(String vspId, Version version, String user) { -- cgit 1.2.3-korg