Skip to content

Commit

Permalink
Merge develop for v0.0.15 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Dougal Ballantyne committed Oct 29, 2014
2 parents 5c4af5c + 36d16c2 commit 4a4ade2
Show file tree
Hide file tree
Showing 9 changed files with 2,236 additions and 19 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
CHANGELOG
=========

0.0.15
======

* feature:``cfncluster``: Support for Frankfurt region
* feature:``cli``: status call now outputs CREATE_FAILED messages for stacks in error state
* update:``cli``: Improved tags and extra_parameters on CLI
* bugfix:``cli``: Only check config sanity on calls that mutate stack
* updates:``ami``: Pulled latest CentOS errata

0.0.14
======
* feature:``cli``: Introduced sanity_check feature for config
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ everything is done using CloudFormation or resources within AWS.

### Installation

The current working version is cfncluster-0.0.14. The CLI is written in python and uses BOTO for AWS actions. You can install the CLI with the following command:
The current working version is cfncluster-0.0.15. The CLI is written in python and uses BOTO for AWS actions. You can install the CLI with the following command:

#### Linux/OSX

Expand Down
18 changes: 10 additions & 8 deletions amis.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
us-west-2 ami-2199d511
eu-west-1 ami-7eca6609
sa-east-1 ami-91de6a8c
us-east-1 ami-6e71c806
ap-northeast-1 ami-299cab28
us-west-1 ami-05848e40
ap-southeast-1 ami-5cac8a0e
ap-southeast-2 ami-9b6f02a1
us-west-2 ami-ef632ddf
eu-central-1 ami-1c132501
sa-east-1 ami-d3d364ce
ap-northeast-1 ami-2188bb20
eu-west-1 ami-3470d943
us-east-1 ami-f4ea6b9c
us-west-1 ami-c30e1a86
ap-southeast-2 ami-537e1269
ap-southeast-1 ami-0c70505e
us-gov-west-1 ami-8f1573ac
10 changes: 8 additions & 2 deletions cli/cfncluster/cfncluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ def status(args):
sys.stdout.write('\rStatus: %s' % status)
sys.stdout.flush()
if not args.nowait:
while ((status != 'CREATE_COMPLETE') and (status != 'UPDATE_COMPLETE') and (status != 'ROLLBACK_COMPLETE')):
while ((status != 'CREATE_COMPLETE') and (status != 'UPDATE_COMPLETE')
and (status != 'ROLLBACK_COMPLETE') and (status != 'CREATE_FAILED')):
time.sleep(5)
status = cfnconn.describe_stacks(stack)[0].stack_status
events = cfnconn.describe_stack_events(stack)[0]
Expand All @@ -273,6 +274,11 @@ def status(args):
outputs = cfnconn.describe_stacks(stack)[0].outputs
for output in outputs:
print output
elif ((status == 'ROLLBACK_COMPLETE') or (status == 'CREATE_FAILED')):
events = cfnconn.describe_stack_events(stack)
for event in events:
if event.resource_status == 'CREATE_FAILED':
print event.timestamp, event.resource_status, event.resource_type, event.logical_resource_id, event.resource_status_reason
else:
sys.stdout.write('\n')
sys.stdout.flush()
Expand All @@ -290,7 +296,7 @@ def status(args):


def delete(args):
print('Terminating: %s' % args.cluster_name)
print('Deleting: %s' % args.cluster_name)
stack = ('cfncluster-' + args.cluster_name)

config = cfnconfig.CfnClusterConfig(args)
Expand Down
23 changes: 22 additions & 1 deletion cli/cfncluster/cfnconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ def __init__(self, args):
self.__sanity_check = __config.getboolean('global', 'sanity_check')
except ConfigParser.NoOptionError:
self.__sanity_check = False
# Only check config on calls that mutate it
__args_func = self.args.func.func_name
if (__args_func == 'create' or __args_func == 'update') and self.__sanity_check is True:
pass
else:
self.__sanity_check = False

# Determine the EC2 region to used used or default to us-east-1
# Order is 1) CLI arg 2) AWS_DEFAULT_REGION env 3) Config file 4) us-east-1
Expand Down Expand Up @@ -129,7 +135,10 @@ def __init__(self, args):
config_sanity.check_resource(self.region,self.aws_access_key_id, self.aws_secret_access_key,
'URL', self.template_url)
except ConfigParser.NoOptionError:
self.template_url = ('https://s3.amazonaws.com/cfncluster-%s/templates/cfncluster-%s.cfn.json' % (self.region, self.version))
if self.region == 'eu-central-1':
self.template_url = ('https://s3.%s.amazonaws.com/cfncluster-%s/templates/cfncluster-%s.cfn.json' % (self.region, self.region, self.version))
else:
self.template_url = ('https://s3-%s.amazonaws.com/cfncluster-%s/templates/cfncluster-%s.cfn.json' % (self.region, self.region, self.version))
except AttributeError:
pass

Expand Down Expand Up @@ -242,3 +251,15 @@ def __init__(self, args):
except AttributeError:
pass

# Handle extra parameters supplied on command-line
try:
if self.args.extra_parameters is not None:
self.parameters = dict(self.parameters)
self.__temp_dict = dict(self.parameters.items() + self.args.extra_parameters.items())
self.__dictlist = []
for key, value in self.__temp_dict.iteritems():
temp = [str(key),str(value)]
self.__dictlist.append(temp)
self.parameters = self.__dictlist
except AttributeError:
pass
5 changes: 3 additions & 2 deletions cli/cfncluster/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import argparse
import logging
import platform
import json

import cfncluster

Expand Down Expand Up @@ -81,9 +82,9 @@ def main():
help='specify a URL for a custom cloudformation template')
pcreate.add_argument("--cluster-template", "-t", type=str, dest="cluster_template", default=None,
help='specify a specific cluster template to use')
pcreate.add_argument("--extra-parameters", "-p", type=str, dest="extra_parameters", default=None,
pcreate.add_argument("--extra-parameters", "-p", type=json.loads, dest="extra_parameters", default=None,
help='add extra parameters to stack create')
pcreate.add_argument("--tags", "-g", type=str, dest="tags", default=None,
pcreate.add_argument("--tags", "-g", type=json.loads, dest="tags", default=None,
help='tags to be added to the stack')
pcreate.set_defaults(func=create)

Expand Down
5 changes: 3 additions & 2 deletions cli/cfncluster/examples/config
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ sanity_check = true
# replace these with your AWS keys
# If not defined, boto will attempt to use a) enviornment
# or b) EC2 IAM role.
#aws_access_key_id= #your_aws_access_key_id
#aws_access_key_id = #your_aws_access_key_id
#aws_secret_access_key = #your_secret_access_key
# Uncomment to specify a different Amazon AWS region (OPTIONAL)
#aws_region_name = us-west-2
# (Defaults to us-east-1 if not defined in enviornment or below)
#aws_region_name = #region

## cfncluster templates
[cluster default]
Expand Down
4 changes: 2 additions & 2 deletions cli/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()

console_scripts = ['cfncluster = cfncluster.cli:main']
version = "0.0.14"
requires = ['boto>=2.33', 'botocore']
version = "0.0.15"
requires = ['boto>=2.34']

if sys.version_info[:2] == (2, 6):
# For python2.6 we have to require argparse since it
Expand Down
2,179 changes: 2,178 additions & 1 deletion cloudformation/cfncluster.cfn.json

Large diffs are not rendered by default.

0 comments on commit 4a4ade2

Please sign in to comment.