Fix VSP update backend process 98/120598/3
authorandre.schmid <andre.schmid@est.tech>
Thu, 15 Apr 2021 10:15:31 +0000 (11:15 +0100)
committerChristophe Closset <christophe.closset@intl.att.com>
Mon, 19 Apr 2021 15:49:19 +0000 (15:49 +0000)
Fix the VSP update procedure which was being rejected by a condition
that checks if a VFC being created has the same name, type and vendor
release. This was recently introduced to avoid duplicate VFC creation
during the initialization process.
This change adds a condition to confirm that no VSP CSAR is involved,
before trying to check for the name, type and vendor release.

Change-Id: Ie46195e810cd72f7412acc7cb01a764ef010f58d
Issue-ID: SDC-3561
Signed-off-by: André Schmid <andre.schmid@est.tech>
catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java

index 787bc3e..b1841e5 100644 (file)
@@ -176,7 +176,7 @@ public class ResourceImportManager {
                 if (latestByName.isLeft()) {
                     throw new ByActionStatusComponentException(ActionStatus.COMPONENT_NAME_ALREADY_EXIST, resource.getName());
                 }
-            } else {
+            } else if (!isCsarPresent(csarInfo)) {
                 final Either<Resource, StorageOperationStatus> component = toscaOperationFacade
                     .getComponentByNameAndVendorRelease(resource.getComponentType(), resource.getName(), resource.getVendorRelease(),
                         JsonParseFlagEnum.ParseAll);
@@ -210,6 +210,10 @@ public class ResourceImportManager {
         return responsePair;
     }
 
+    private boolean isCsarPresent(final CsarInfo csarInfo) {
+        return csarInfo != null && StringUtils.isNotEmpty(csarInfo.getCsarUUID());
+    }
+
     private String getLatestCertifiedResourceId(Resource resource) {
         Map<String, String> allVersions = resource.getAllVersions();
         Double latestCertifiedVersion = 0.0;