From 21998c07ef896dfaa5fb0e634ac7cc9b78fade60 Mon Sep 17 00:00:00 2001 From: Luca Giommi Date: Mon, 29 Jul 2024 09:50:19 +0200 Subject: [PATCH] fix IAM clients and S3 buckets creation when deployment fails in a provider --- .../deployment/providers/ImServiceImpl.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/java/it/reply/orchestrator/service/deployment/providers/ImServiceImpl.java b/src/main/java/it/reply/orchestrator/service/deployment/providers/ImServiceImpl.java index 3e598ca527..0e5ca8ef73 100644 --- a/src/main/java/it/reply/orchestrator/service/deployment/providers/ImServiceImpl.java +++ b/src/main/java/it/reply/orchestrator/service/deployment/providers/ImServiceImpl.java @@ -292,6 +292,15 @@ public boolean doDeploy(DeploymentMessage deploymentMessage) { for (Resource resource : resources.get(false)) { if (resource.getToscaNodeType().equals(IAM_TOSCA_NODE_TYPE)) { String nodeName = resource.getToscaNodeName(); + + // If resource metadata is not empty means that the IAM client is already created. + // If it is, fill iamTemplateOutput with resource metadata info, then continue to next + // resource + if (resource.getMetadata() != null) { + iamTemplateOutput.put(nodeName, resource.getMetadata()); + continue; + } + LOG.info("Found node of type: {}. Node name: {}", IAM_TOSCA_NODE_TYPE, nodeName); String scopes; String issuerNode; @@ -418,6 +427,15 @@ public boolean doDeploy(DeploymentMessage deploymentMessage) { // Manage creation of an S3 bucket if (resource.getToscaNodeType().equals(toscaService.getS3ToscaNodeType())) { String nodeName = resource.getToscaNodeName(); + + // If resource metadata is not empty means that the S3 bucket is already created. + // If it is, fill s3TemplateOutput with resource metadata info, then continue to next + // resource + if (resource.getMetadata() != null) { + s3TemplateOutput.put(nodeName, resource.getMetadata()); + continue; + } + String userGroup = deployment.getUserGroup(); Map s3Result = null; String bucketName = null;