From 4be575fdc3d1b085584a2ff0098e23b6a0d59c47 Mon Sep 17 00:00:00 2001 From: Dougal Ballantyne Date: Mon, 29 Sep 2014 13:26:53 +0200 Subject: [PATCH] Fixing AvailabilityZone update command --- CHANGELOG.rst | 6 ++++-- README.md | 2 +- cli/cfncluster/cfncluster.py | 15 +++++++++++++++ cli/setup.py | 2 +- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d0a7bd5107..eee3390773 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,19 +2,21 @@ CHANGELOG ========= +0.0.13 +====== +* bugfix:``cli``: Fixed missing AvailabilityZone for "update" command + 0.0.12 ====== * updates:``cli``: Simplfied VPC config and removed multi-AZ - 0.0.11 ====== * updates:``ami``: Pulled latest CentOS errata * updates:``ami``: Removed DKMS Lustre; replaced with Intel Lustre Client - 0.0.10 ====== diff --git a/README.md b/README.md index ced9659cab..c06528bfdb 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ everything is done using CloudFormation or resources within AWS. ### Installation -The current working version is cfncluster-0.0.12. 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.13. The CLI is written in python and uses BOTO for AWS actions. You can install the CLI with the following command: #### Linux/OSX diff --git a/cli/cfncluster/cfncluster.py b/cli/cfncluster/cfncluster.py index 1eb00198fe..a8a0b221d6 100644 --- a/cli/cfncluster/cfncluster.py +++ b/cli/cfncluster/cfncluster.py @@ -105,6 +105,21 @@ def update(args): desired_capacity = asgconn.get_all_groups(names=[asg])[0].desired_capacity config.parameters.append(('InitialQueueSize', desired_capacity)) + # Get the MasterSubnetId and use it to determine AvailabilityZone + try: + i = [p[0] for p in config.parameters].index('MasterSubnetId') + master_subnet_id = config.parameters[i][1] + try: + vpcconn = boto.vpc.connect_to_region(config.region,aws_access_key_id=config.aws_access_key_id, + aws_secret_access_key=config.aws_secret_access_key) + availability_zone = str(vpcconn.get_all_subnets(subnet_ids=master_subnet_id)[0].availability_zone) + except boto.exception.BotoServerError as e: + print e.message + sys.exit(1) + config.parameters.append(('AvailabilityZone', availability_zone)) + except ValueError: + pass + try: logger.debug((config.template_url, config.parameters)) stack = cfnconn.update_stack(stack_name,template_url=config.template_url, diff --git a/cli/setup.py b/cli/setup.py index cb372533cd..a38c60cecf 100644 --- a/cli/setup.py +++ b/cli/setup.py @@ -20,7 +20,7 @@ def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() console_scripts = ['cfncluster = cfncluster.cli:main'] -version = "0.0.12" +version = "0.0.13" requires = ['boto>=2.32.1', 'botocore'] if sys.version_info[:2] == (2, 6):