diff options
author | MichaelMorris <michael.morris@est.tech> | 2021-03-24 15:00:53 +0000 |
---|---|---|
committer | Christophe Closset <christophe.closset@intl.att.com> | 2021-03-26 08:20:44 +0000 |
commit | 316a6df0f1a42cb3f825b9ab4b51d9d59215a530 (patch) | |
tree | d288760a47db62025cff266538434cd4a5259273 /catalog-be | |
parent | 714493fb9588598b969711bf761f301ba8ebe286 (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
Diffstat (limited to 'catalog-be')
-rw-r--r-- | catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java | 6 |
1 files changed, 5 insertions, 1 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 fa58e61d3b..c8162d700b 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 @@ -1875,7 +1875,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { 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()); log.trace("************* finished to create node {}", nodeTypeEntry.getKey()); @@ -1902,6 +1902,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, |