Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
Merge 09f29ad into 194ffb4
Browse files Browse the repository at this point in the history
  • Loading branch information
mattpep committed Feb 28, 2017
2 parents 194ffb4 + 09f29ad commit eca9af0
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion bootstrap_cfn/fab_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,17 @@ def cfn_create(test=False):
"""
_validate_fabric_env()
stack_name = get_stack_name(new=True)
stack_id = stack_name.split('-')[-1]
cfn_config = get_config(called_by_cfn_create=True)
try:
stack_tag = get_env_tag()
except AttributeError:
stack_tag = 'active'
env.tag = stack_tag
r53_conn = get_connection(R53)
zone_name = get_zone_name()
zone_id = get_zone_id()
txt_tag_record = get_tag_record_name(stack_tag)

cfn = get_connection(Cloudformation)
if test:
Expand Down Expand Up @@ -738,7 +748,15 @@ def cfn_create(test=False):
# So delete the SSL cert that we uploaded
if 'ssl' in cfn_config.data:
iam.delete_ssl_certificate(cfn_config.ssl(), stack_name)
abort('Failed to create stack: {0}'.format(stack))
# delete the DNS tag
for elb in get_all_elbs():
logger.info("Deleting '{}-{}' from '{}' ({})...".format(elb, stack_id, zone_name, zone_id))
try:
print green("Removing tag stack from DNS...")
r53_conn.delete_txt_record(zone_name, zone_id, txt_tag_record)
except boto.route53.exception.DNSServerError:
print red("Failed to remove DNS tag")
abort(red('Failed to create stack: {0}. You may want to delete it manually.'.format(stack)))
return True


Expand Down

0 comments on commit eca9af0

Please sign in to comment.