exit on cred check - ec2 errors for bad keys
This commit is contained in:
@@ -88,6 +88,9 @@ def describe_instances():
|
|||||||
if e.response['Error']['Code'] == 'UnauthorizedOperation':
|
if e.response['Error']['Code'] == 'UnauthorizedOperation':
|
||||||
print('{} : (UnauthorizedOperation) when calling the DescribeInstances -- sure you have ec2 permissions?' .format(AWS_ACCESS_KEY_ID))
|
print('{} : (UnauthorizedOperation) when calling the DescribeInstances -- sure you have ec2 permissions?' .format(AWS_ACCESS_KEY_ID))
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
elif e.response['Error']['Code'] == 'AuthFailure':
|
||||||
|
print('{} : (AuthFailure) when calling the DescribeInstances -- key is invalid or no permissions.' .format(AWS_ACCESS_KEY_ID))
|
||||||
|
sys.exit()
|
||||||
else:
|
else:
|
||||||
print(e)
|
print(e)
|
||||||
if len(response['Reservations']) <= 0:
|
if len(response['Reservations']) <= 0:
|
||||||
@@ -132,6 +135,9 @@ def describe_instances_basic():
|
|||||||
if e.response['Error']['Code'] == 'UnauthorizedOperation':
|
if e.response['Error']['Code'] == 'UnauthorizedOperation':
|
||||||
print('{} : (UnauthorizedOperation) when calling the DescribeInstances -- sure you have ec2 permissions?' .format(AWS_ACCESS_KEY_ID))
|
print('{} : (UnauthorizedOperation) when calling the DescribeInstances -- sure you have ec2 permissions?' .format(AWS_ACCESS_KEY_ID))
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
elif e.response['Error']['Code'] == 'AuthFailure':
|
||||||
|
print('{} : (AuthFailure) when calling the DescribeInstances -- key is invalid or no permissions for region.' .format(AWS_ACCESS_KEY_ID))
|
||||||
|
sys.exit()
|
||||||
else:
|
else:
|
||||||
print(e)
|
print(e)
|
||||||
if len(response['Reservations']) <= 0:
|
if len(response['Reservations']) <= 0:
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import builtins
|
|||||||
os.environ['AWS_SHARED_CREDENTIALS_FILE'] = '.env'
|
os.environ['AWS_SHARED_CREDENTIALS_FILE'] = '.env'
|
||||||
|
|
||||||
# If you want to use a transparent + supports SSL proxy you can put it here
|
# If you want to use a transparent + supports SSL proxy you can put it here
|
||||||
# os.environ['HTTPS_PROXY'] = 'https://127.0.0.1:8888'
|
# os.environ['HTTPS_PROXY'] = 'https://149.56.108.133:3128'
|
||||||
|
|
||||||
sys.path.append("modules")
|
sys.path.append("modules")
|
||||||
for module in all_modules:
|
for module in all_modules:
|
||||||
@@ -67,8 +67,8 @@ def method_create():
|
|||||||
try:
|
try:
|
||||||
perform_credential_check()
|
perform_credential_check()
|
||||||
except:
|
except:
|
||||||
print("Please supply keys as outlined in our README.md file")
|
print("Check the above error message and fix to use weirdAAL")
|
||||||
# exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if (args.list):
|
if (args.list):
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user