Skip to content

Commit

Permalink
Merge pull request #2639 from ClusterHQ/delete-s3-bucket-cloudformati…
Browse files Browse the repository at this point in the history
…on-flock-4181

[FLOC-4181] Cleanup and delete S3 bucket at the end of CloudFormation setup
  • Loading branch information
wallrj committed Feb 16, 2016
2 parents 9344dca + 98845e0 commit c1d1594
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
5 changes: 0 additions & 5 deletions admin/installer/cloudformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,9 +398,4 @@ def _validate_cluster_size(size):
Value="export DOCKER_TLS_VERIFY=1",
Description="Client config: Enable TLS client for Swarm."
))
template.add_output(Output(
"S3Bucket",
Value=Ref(s3bucket),
Description="Name of S3 bucket to hold cluster configuration files."
))
print(template.to_json())
7 changes: 7 additions & 0 deletions admin/installer/setup_client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,12 @@ ${DOCKER_CERT_HOME}/createclient.exp
# Copy Docker Certificates directory to Ubuntu's home directory.
cp -r ${DOCKER_CERT_HOME} ${UBUNTU_HOME}

# Clear out S3 bucket used by CloudFormation so that subsequent stack destroy attempt succeeds.
s3cmd_wrapper del --recursive --config=/root/.s3cfg s3://${s3_bucket}

# Delete S3 bucket with CloudFormation configuration.
s3cmd_wrapper rb --config=/root/.s3cfg s3://${s3_bucket}


# Signal successful stack creation.
curl ${SUCCESS_SIGNAL_URL} || echo "Failed to report success to ClusterHQ"
8 changes: 0 additions & 8 deletions admin/test/test_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,6 @@ def delete_cloudformation_stack(stack_id, aws_config):
process environment before running the ``aws`` sub-command.
:returns: A ``Deferred`` which fires when the stack has been deleted.
"""
result = get_stack_report(stack_id, aws_config)
outputs = result['Outputs']
s3_bucket_name = get_output(outputs, 'S3Bucket')
aws_output(
['s3', 'rb', 's3://{}'.format(s3_bucket_name), '--force'],
aws_config,
)

aws_output(
['cloudformation', 'delete-stack',
'--stack-name', stack_id],
Expand Down

0 comments on commit c1d1594

Please sign in to comment.