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

Commit

Permalink
Merge pull request #62 from ministryofjustice/abort_on_rollback
Browse files Browse the repository at this point in the history
Abort execution on stack creation failure
  • Loading branch information
ashb committed Apr 8, 2015
2 parents 1409e76 + 6560326 commit e4e41a2
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions bootstrap_cfn/fab_tasks.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
#!/usr/bin/env python

import os
from StringIO import StringIO
import sys
import random
import yaml

from fabric.api import env, task, sudo, put
from fabric.contrib.project import upload_project
from fabric.utils import abort

from bootstrap_cfn.config import ProjectConfig, ConfigParser
from bootstrap_cfn.cloudformation import Cloudformation
from bootstrap_cfn.ec2 import EC2
from bootstrap_cfn.iam import IAM

import os
from StringIO import StringIO

from fabric.api import env, task, sudo, put
from fabric.contrib.project import upload_project

# GLOBAL VARIABLES
env.application = None
Expand Down Expand Up @@ -164,10 +166,10 @@ def cfn_create():
if stack_evt.resource_status == 'CREATE_COMPLETE':
print 'Successfully built stack {0}.'.format(stack)
else:
print 'Failed to create stack: {0}'.format(stack)
# 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))


@task
Expand Down

0 comments on commit e4e41a2

Please sign in to comment.