Skip to content

Commit

Permalink
Added python version checking for fabric command
Browse files Browse the repository at this point in the history
  • Loading branch information
mcianfrocco committed May 11, 2017
1 parent 743cc87 commit 005fbcb
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions aws/launch_AWS_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,12 @@ def module_exists(module_name):
def exec_remote_cmd(cmd):
from fabric.operations import run, put
from fabric.api import hide,settings
with hide('output','running','warnings'), settings(warn_only=True):
return run(cmd)

if float(sys.version_info[1])>=7:
with hide('output','running','warnings'), settings(warn_only=True):
return run(cmd)
if float(sys.version_info[1])<7:
with hide('output','running','warnings') and settings(warn_only=True):
return run(cmd)
#==============================
def query_yes_no(question, default="no"):
valid = {"yes": True, "y": True, "ye": True,"no": False, "n": False}
Expand All @@ -404,7 +407,7 @@ def query_yes_no(question, default="no"):
#==============================
if __name__ == "__main__":

availInstances=['t2.micro','t2.nano','t2.small','t2.medium','t2.large','i2.2xlarge','i2.xlarge','m4.large','m4.xlarge','m4.2xlarge','m4.4xlarge','m4.10xlarge','m4.16xlarge','m3.medium','m3.large','m3.xlarge','m3.2xlarge','c4.large','c4.xlarge','c4.2xlarge','c4.4xlarge','c4.8xlarge','c3.large','c3.xlarge','c3.2xlarge','c3.4xlarge','c3.xlarge','r4.16xlarge','r4.4xlarge','r4.8xlarge','r3.large','r3.xlarge','r3.2xlarge','r3.4xlarge','r3.8xlarge','d2.xlarge','d2.2xlarge','d2.8xlarge','p2.xlarge','p2.8xlarge','p2.16xlarge','g2.2xlarge','g2.8xlarge']
availInstances=['t2.micro','t2.nano','t2.small','t2.medium','t2.large','i2.2xlarge','i2.xlarge','m4.large','m4.xlarge','m4.2xlarge','m4.4xlarge','m4.10xlarge','m4.16xlarge','m3.medium','m3.large','m3.xlarge','m3.2xlarge','c4.large','c4.xlarge','c4.2xlarge','c4.4xlarge','c4.8xlarge','c3.large','c3.xlarge','c3.2xlarge','c3.4xlarge','c3.xlarge','r4.16xlarge','r4.4xlarge','r4.8xlarge','r3.large','r3.xlarge','r3.2xlarge','r3.4xlarge','r3.8xlarge','x1.32xlarge','d2.xlarge','d2.2xlarge','d2.8xlarge','p2.xlarge','p2.8xlarge','p2.16xlarge','g2.2xlarge','g2.8xlarge']

params=setupParserOptions()
if params['listInstance'] is True:
Expand Down

0 comments on commit 005fbcb

Please sign in to comment.