From 3f491e5bd14b2af329975d4e75604276a0a8f3b3 Mon Sep 17 00:00:00 2001 From: troymc Date: Tue, 5 Apr 2016 15:21:24 +0200 Subject: [PATCH] Ensure Python 2.5-2.7 when using AWS deploy scripts --- deploy-cluster-aws/launch_ec2_nodes.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/deploy-cluster-aws/launch_ec2_nodes.py b/deploy-cluster-aws/launch_ec2_nodes.py index 3c37824d..2c717f6f 100644 --- a/deploy-cluster-aws/launch_ec2_nodes.py +++ b/deploy-cluster-aws/launch_ec2_nodes.py @@ -12,6 +12,7 @@ """ from __future__ import unicode_literals +import sys import time import argparse import botocore @@ -20,6 +21,17 @@ from awscommon import ( get_naeips, ) +# First, ensure they're using Python 2.5-2.7 +pyver = sys.version_info +major = pyver[0] +minor = pyver[1] +print('You are in an environment where "python" is Python {}.{}'. + format(major, minor)) +if not ((major == 2) and (minor >= 5) and (minor <= 7)): + print('but Fabric only works with Python 2.5-2.7') + sys.exit(1) + +# Parse the command-line arguments parser = argparse.ArgumentParser() parser.add_argument("--tag", help="tag to add to all launched instances on AWS", @@ -48,7 +60,7 @@ print('Checking if you have enough allocated-but-unassociated ' + non_associated_eips = get_naeips(client) -print('You have {} allocated elactic IPs which are ' +print('You have {} allocated elastic IPs which are ' 'not already associated with instances'. format(len(non_associated_eips)))