Skip to content

Commit f2a8bad

Browse files
author
Dougal Ballantyne
committed
Updated template and improved region handling.
1 parent 520301c commit f2a8bad

File tree

5 files changed

+28
-18
lines changed

5 files changed

+28
-18
lines changed

cli/cfncluster/cfncluster.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,15 @@ def create(args):
3232
config.parameters.append(('ComputeWaitConditionCount', initial_queue_size))
3333
except ValueError:
3434
pass
35+
3536
capabilities = ["CAPABILITY_IAM"]
3637
cfnconn = boto.cloudformation.connect_to_region(config.region,aws_access_key_id=config.aws_access_key_id,
3738
aws_secret_access_key=config.aws_secret_access_key)
3839
try:
3940
logger.debug((config.template_url, config.parameters))
4041
stack = cfnconn.create_stack(('cfncluster-' + args.cluster_name),template_url=config.template_url,
4142
parameters=config.parameters, capabilities=capabilities,
42-
disable_rollback=args.norollback)
43+
disable_rollback=args.norollback, tags=args.tags)
4344
status = cfnconn.describe_stacks(stack)[0].stack_status
4445
if not args.nowait:
4546
while status == 'CREATE_IN_PROGRESS':

cli/cfncluster/cfnconfig.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,17 @@ def __init__(self, args):
9494
raise Exception
9595

9696
# Determine the EC2 region to used used or default to us-east-1
97-
# Order is 1) CLI arg 2) Config file 3) us-east-1
97+
# Order is 1) CLI arg 2) AWS_DEFAULT_REGION env 3) Config file 4) us-east-1
9898
if args.region:
9999
self.region = args.region
100100
else:
101-
try:
102-
self.region = __config.get('aws', 'aws_region_name')
103-
except ConfigParser.NoOptionError:
104-
self.region = 'us-east-1'
101+
if os.environ.get('AWS_DEFAULT_REGION'):
102+
self.region = os.environ.get('AWS_DEFAULT_REGION')
103+
else:
104+
try:
105+
self.region = __config.get('aws', 'aws_region_name')
106+
except ConfigParser.NoOptionError:
107+
self.region = 'us-east-1'
105108

106109
# Check if credentials have been provided in config
107110
try:

cli/cfncluster/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def main():
5858
# add the handler to the root logger
5959
logging.getLogger('cfncluster.cli').addHandler(console)
6060

61-
parser = argparse.ArgumentParser(description='cfncluster is the a tool to launch and manage cluster.')
61+
parser = argparse.ArgumentParser(description='cfncluster is a tool to launch and manage a cluster.')
6262
parser.add_argument("--config", "-c", dest="config_file", help='specify a alternative config file')
6363
parser.add_argument( "--region", "-r", dest="region", help='specify a specific region to connect to',
6464
default=None)

cli/setup.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions and
1010
# limitations under the License.
1111

12-
import os
12+
import os, sys
1313
from setuptools import setup, find_packages
1414

1515
# Utility function to read the README file.
@@ -20,7 +20,13 @@ 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.9"
23+
version = "0.0.10"
24+
requires = ['boto', 'botocore']
25+
26+
if sys.version_info[:2] == (2, 6):
27+
# For python2.6 we have to require argparse since it
28+
# was not in stdlib until 2.7.
29+
requires.append('argparse>=1.1')
2430

2531
setup(
2632
name = "cfncluster",
@@ -31,7 +37,7 @@ def read(fname):
3137
url = ("https://github.com/awslabs/cfncluster"),
3238
license = "Amazon Software License",
3339
packages = find_packages(),
34-
install_requires=['boto', 'argparse'],
40+
install_requires = requires,
3541
entry_points=dict(console_scripts=console_scripts),
3642
include_package_data = True,
3743
zip_safe = False,

cloudformation/cfncluster.cfn.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -588,28 +588,28 @@
588588
},
589589
"AWSRegionArch2AMI" : {
590590
"eu-west-1" : {
591-
"64HVM" : "ami-7df5220a"
591+
"64HVM" : "ami-b04290c7"
592592
},
593593
"us-east-1" : {
594-
"64HVM" : "ami-0c458764"
594+
"64HVM" : "ami-208a5b48"
595595
},
596596
"ap-northeast-1" : {
597-
"64HVM" : "ami-4f38684e"
597+
"64HVM" : "ami-75411874"
598598
},
599599
"us-west-2" : {
600-
"64HVM" : "ami-750f7645"
600+
"64HVM" : "ami-ed5822dd"
601601
},
602602
"sa-east-1" : {
603-
"64HVM" : "ami-7753fd6a"
603+
"64HVM" : "ami-fde54de0"
604604
},
605605
"us-west-1" : {
606-
"64HVM" : "ami-1b8c8c5e"
606+
"64HVM" : "ami-1b78755e"
607607
},
608608
"ap-southeast-1" : {
609-
"64HVM" : "ami-da4e1788"
609+
"64HVM" : "ami-220e5570"
610610
},
611611
"ap-southeast-2" : {
612-
"64HVM" : "ami-e5a9cedf"
612+
"64HVM" : "ami-c181e7fb"
613613
}
614614
}
615615
},

0 commit comments

Comments
 (0)