Fix VSP update backend process
[sdc.git] / 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;