1
Fork 0

Allow empty aws identifier and secret, boto will load standard creds

This commit is contained in:
Andrew Pilloud 2015-07-13 13:15:48 -07:00
parent 79f66811e8
commit 71b05a429e
1 changed files with 7 additions and 9 deletions

View File

@ -107,15 +107,12 @@ class EC2LatentBuildSlave(AbstractLatentBuildSlave):
if aws_id_file_path is None:
home = os.environ['HOME']
aws_id_file_path = os.path.join(home, '.ec2', 'aws_id')
if not os.path.exists(aws_id_file_path):
raise ValueError(
"Please supply your AWS access key identifier and secret "
"access key identifier either when instantiating this %s "
"or in the %s file (on two lines).\n" %
(self.__class__.__name__, aws_id_file_path))
with open(aws_id_file_path, 'r') as aws_file:
identifier = aws_file.readline().strip()
secret_identifier = aws_file.readline().strip()
if not os.path.exists(aws_id_file_path):
aws_id_file_path = None
if aws_id_file_path and os.path.exists(aws_id_file_path):
with open(aws_id_file_path, 'r') as aws_file:
identifier = aws_file.readline().strip()
secret_identifier = aws_file.readline().strip()
else:
assert aws_id_file_path is None, \
'if you supply the identifier and secret_identifier, ' \
@ -160,6 +157,7 @@ class EC2LatentBuildSlave(AbstractLatentBuildSlave):
if 'InvalidKeyPair.NotFound' not in e.body:
if 'AuthFailure' in e.body:
print ('POSSIBLE CAUSES OF ERROR:\n'
' Did you supply your AWS credentials?\n'
' Did you sign up for EC2?\n'
' Did you put a credit card number in your AWS '
'account?\n'