aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichaelMorris <michael.morris@est.tech>2021-03-24 15:00:53 +0000
committerChristophe Closset <christophe.closset@intl.att.com>2021-04-15 09:50:29 +0000
commit749aa2119a5201a5ff503b98370b61b082e18455 (patch)
treeb1ff736a10cb33e98d9fa2dee8e23b309763fd28
parentf8cfff869c64e9aa6aa3a4cdaa87e8fb25ac0ee3 (diff)
Fix issue with global substitutions
Check if node types in the global substitutions file already exist before attempting to create them Signed-off-by: MichaelMorris <michael.morris@est.tech> Issue-ID: SDC-3533 Change-Id: I8129e3108e27f3bae4f33e1bd652d8b74ae34de9 (cherry picked from commit 316a6df0f1a42cb3f825b9ab4b51d9d59215a530)
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java
index a3d746da89..c7a98a2587 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java
@@ -2224,8 +2224,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
CsarInfo csarInfo, String nodeName) {
try {
for (Entry<String, NodeTypeInfo> nodeTypeEntry : nodeTypesInfo.entrySet()) {
- if (nodeTypeEntry.getValue()
- .isNested()) {
+ if (nodeTypeEntry.getValue().isNested() && !nodeTypeAlreadyExists(nodeTypeEntry.getKey())) {
handleNestedVfc(resource, nodeTypesArtifactsToHandle, nodeTypesNewCreatedArtifacts, nodeTypesInfo,
csarInfo, nodeTypeEntry.getKey());
@@ -2256,6 +2255,10 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
throw e;
}
}
+
+ private boolean nodeTypeAlreadyExists(final String toscaResourceName) {
+ return toscaOperationFacade.getLatestByToscaResourceName(toscaResourceName).isLeft();
+ }
private Either<Resource, ResponseFormat> handleVfCsarArtifacts(Resource resource, CsarInfo csarInfo,
List<ArtifactDefinition> createdArtifacts, ArtifactOperationInfo artifactOperation, boolean shouldLock,