Skip to content

Commit 4a4ade2

Browse files
author
Dougal Ballantyne
committed
Merge develop for v0.0.15 release
2 parents 5c4af5c + 36d16c2 commit 4a4ade2

File tree

9 files changed

+2236
-19
lines changed

9 files changed

+2236
-19
lines changed

CHANGELOG.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
CHANGELOG
33
=========
44

5+
0.0.15
6+
======
7+
8+
* feature:``cfncluster``: Support for Frankfurt region
9+
* feature:``cli``: status call now outputs CREATE_FAILED messages for stacks in error state
10+
* update:``cli``: Improved tags and extra_parameters on CLI
11+
* bugfix:``cli``: Only check config sanity on calls that mutate stack
12+
* updates:``ami``: Pulled latest CentOS errata
13+
514
0.0.14
615
======
716
* feature:``cli``: Introduced sanity_check feature for config

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ everything is done using CloudFormation or resources within AWS.
88

99
### Installation
1010

11-
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:
11+
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:
1212

1313
#### Linux/OSX
1414

amis.txt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
us-west-2 ami-2199d511
2-
eu-west-1 ami-7eca6609
3-
sa-east-1 ami-91de6a8c
4-
us-east-1 ami-6e71c806
5-
ap-northeast-1 ami-299cab28
6-
us-west-1 ami-05848e40
7-
ap-southeast-1 ami-5cac8a0e
8-
ap-southeast-2 ami-9b6f02a1
1+
us-west-2 ami-ef632ddf
2+
eu-central-1 ami-1c132501
3+
sa-east-1 ami-d3d364ce
4+
ap-northeast-1 ami-2188bb20
5+
eu-west-1 ami-3470d943
6+
us-east-1 ami-f4ea6b9c
7+
us-west-1 ami-c30e1a86
8+
ap-southeast-2 ami-537e1269
9+
ap-southeast-1 ami-0c70505e
10+
us-gov-west-1 ami-8f1573ac

cli/cfncluster/cfncluster.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,8 @@ def status(args):
260260
sys.stdout.write('\rStatus: %s' % status)
261261
sys.stdout.flush()
262262
if not args.nowait:
263-
while ((status != 'CREATE_COMPLETE') and (status != 'UPDATE_COMPLETE') and (status != 'ROLLBACK_COMPLETE')):
263+
while ((status != 'CREATE_COMPLETE') and (status != 'UPDATE_COMPLETE')
264+
and (status != 'ROLLBACK_COMPLETE') and (status != 'CREATE_FAILED')):
264265
time.sleep(5)
265266
status = cfnconn.describe_stacks(stack)[0].stack_status
266267
events = cfnconn.describe_stack_events(stack)[0]
@@ -273,6 +274,11 @@ def status(args):
273274
outputs = cfnconn.describe_stacks(stack)[0].outputs
274275
for output in outputs:
275276
print output
277+
elif ((status == 'ROLLBACK_COMPLETE') or (status == 'CREATE_FAILED')):
278+
events = cfnconn.describe_stack_events(stack)
279+
for event in events:
280+
if event.resource_status == 'CREATE_FAILED':
281+
print event.timestamp, event.resource_status, event.resource_type, event.logical_resource_id, event.resource_status_reason
276282
else:
277283
sys.stdout.write('\n')
278284
sys.stdout.flush()
@@ -290,7 +296,7 @@ def status(args):
290296

291297

292298
def delete(args):
293-
print('Terminating: %s' % args.cluster_name)
299+
print('Deleting: %s' % args.cluster_name)
294300
stack = ('cfncluster-' + args.cluster_name)
295301

296302
config = cfnconfig.CfnClusterConfig(args)

cli/cfncluster/cfnconfig.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ def __init__(self, args):
7979
self.__sanity_check = __config.getboolean('global', 'sanity_check')
8080
except ConfigParser.NoOptionError:
8181
self.__sanity_check = False
82+
# Only check config on calls that mutate it
83+
__args_func = self.args.func.func_name
84+
if (__args_func == 'create' or __args_func == 'update') and self.__sanity_check is True:
85+
pass
86+
else:
87+
self.__sanity_check = False
8288

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

@@ -242,3 +251,15 @@ def __init__(self, args):
242251
except AttributeError:
243252
pass
244253

254+
# Handle extra parameters supplied on command-line
255+
try:
256+
if self.args.extra_parameters is not None:
257+
self.parameters = dict(self.parameters)
258+
self.__temp_dict = dict(self.parameters.items() + self.args.extra_parameters.items())
259+
self.__dictlist = []
260+
for key, value in self.__temp_dict.iteritems():
261+
temp = [str(key),str(value)]
262+
self.__dictlist.append(temp)
263+
self.parameters = self.__dictlist
264+
except AttributeError:
265+
pass

cli/cfncluster/cli.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import argparse
1414
import logging
1515
import platform
16+
import json
1617

1718
import cfncluster
1819

@@ -81,9 +82,9 @@ def main():
8182
help='specify a URL for a custom cloudformation template')
8283
pcreate.add_argument("--cluster-template", "-t", type=str, dest="cluster_template", default=None,
8384
help='specify a specific cluster template to use')
84-
pcreate.add_argument("--extra-parameters", "-p", type=str, dest="extra_parameters", default=None,
85+
pcreate.add_argument("--extra-parameters", "-p", type=json.loads, dest="extra_parameters", default=None,
8586
help='add extra parameters to stack create')
86-
pcreate.add_argument("--tags", "-g", type=str, dest="tags", default=None,
87+
pcreate.add_argument("--tags", "-g", type=json.loads, dest="tags", default=None,
8788
help='tags to be added to the stack')
8889
pcreate.set_defaults(func=create)
8990

cli/cfncluster/examples/config

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ sanity_check = true
1313
# replace these with your AWS keys
1414
# If not defined, boto will attempt to use a) enviornment
1515
# or b) EC2 IAM role.
16-
#aws_access_key_id= #your_aws_access_key_id
16+
#aws_access_key_id = #your_aws_access_key_id
1717
#aws_secret_access_key = #your_secret_access_key
1818
# Uncomment to specify a different Amazon AWS region (OPTIONAL)
19-
#aws_region_name = us-west-2
19+
# (Defaults to us-east-1 if not defined in enviornment or below)
20+
#aws_region_name = #region
2021

2122
## cfncluster templates
2223
[cluster default]

cli/setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ def read(fname):
2020
return open(os.path.join(os.path.dirname(__file__), fname)).read()
2121

2222
console_scripts = ['cfncluster = cfncluster.cli:main']
23-
version = "0.0.14"
24-
requires = ['boto>=2.33', 'botocore']
23+
version = "0.0.15"
24+
requires = ['boto>=2.34']
2525

2626
if sys.version_info[:2] == (2, 6):
2727
# For python2.6 we have to require argparse since it

cloudformation/cfncluster.cfn.json

Lines changed: 2178 additions & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)