Skip to content

Commit

Permalink
Fix clients and buckets creation when deployment fails on a provider (#…
Browse files Browse the repository at this point in the history
…28)

* Fix IAM clients and S3 buckets creation when deployment fails in a provider

* Move at the beginning the log message when find an IAM and S3 bucket node

---------

Co-authored-by: Luca Giommi <[email protected]>
  • Loading branch information
lgiommi and lgiommi authored Aug 19, 2024
1 parent df1766b commit 70ccca4
Showing 1 changed file with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,17 @@ public boolean doDeploy(DeploymentMessage deploymentMessage) {
if (resource.getToscaNodeType().equals(IAM_TOSCA_NODE_TYPE)) {
String nodeName = resource.getToscaNodeName();
LOG.info("Found node of type: {}. Node name: {}", IAM_TOSCA_NODE_TYPE, nodeName);

// 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) {
LOG.info("Found an IAM client already created for the {} tosca node. Loading it.",
nodeName);
iamTemplateOutput.put(nodeName, resource.getMetadata());
continue;
}

String scopes;
String issuerNode;
String tokenCredentials = null;
Expand Down Expand Up @@ -418,14 +429,25 @@ public boolean doDeploy(DeploymentMessage deploymentMessage) {
// Manage creation of an S3 bucket
if (resource.getToscaNodeType().equals(toscaService.getS3ToscaNodeType())) {
String nodeName = resource.getToscaNodeName();
LOG.info("Found node of type: {}. Node name: {}", toscaService.getS3ToscaNodeType(),
nodeName);

// 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) {
LOG.info("Found an S3 bucket already created for the {} tosca node. Loading it.",
nodeName);
s3TemplateOutput.put(nodeName, resource.getMetadata());
continue;
}

String userGroup = deployment.getUserGroup();
Map<String, Object> s3Result = null;
String bucketName = null;
String s3Url = null;
String enableVersioning = null;
Map<String, String> resourceMetadata = new HashMap<>();
LOG.info("Found node of type: {}. Node name: {}", toscaService.getS3ToscaNodeType(),
nodeName);

if (s3TemplateInput == null) {
s3TemplateInput = toscaService.getS3Properties(ar);
Expand Down

0 comments on commit 70ccca4

Please sign in to comment.