You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I came across a behavior today that I am not sure if it's expected or can be solved in some way. I was running locally the tests and there was one failing (test_amis.test_ami_filter_wildcard/1/). The problem was that when creating the image it was created under the wrong owner. This was because I had forgotten I had some default profile credentials in ~/.aws/credentials so boto was using them and context.get_current_user() in create_image backend was returning my real AWS key and secret as the user. After removing the credentials from ~/.aws/credentials the test passed. Also changing the describe_images with Owners=['self'] made the test pass but I am not sure if we want for boto to use the real credentials either in ENV vars or shared-credentials files. What do you guys think?
/1/
deftest_ami_filter_wildcard():
ec2_resource=boto3.resource('ec2', region_name='us-west-1')
ec2_client=boto3.client('ec2', region_name='us-west-1')
instance=ec2_resource.create_instances(ImageId='ami-1234abcd', MinCount=1, MaxCount=1)[0]
instance.create_image(Name='test-image')
# create an image with the same owner but will not match the filterinstance.create_image(Name='not-matching-image')
my_images=ec2_client.describe_images(
Owners=['111122223333'],
Filters=[{'Name': 'name', 'Values': ['test*']}]
)['Images']
my_images.should.have.length_of(1)
The text was updated successfully, but these errors were encountered:
I encountered this as well. I'm not sure what, if anything, should be done about it, but I'll add my voice as someone who was confused by this unexpected behavior.
I came across a behavior today that I am not sure if it's expected or can be solved in some way. I was running locally the tests and there was one failing (test_amis.test_ami_filter_wildcard/1/). The problem was that when creating the image it was created under the wrong owner. This was because I had forgotten I had some default profile credentials in ~/.aws/credentials so boto was using them and
context.get_current_user()
in create_image backend was returning my real AWS key and secret as the user. After removing the credentials from ~/.aws/credentials the test passed. Also changing the describe_images with Owners=['self'] made the test pass but I am not sure if we want for boto to use the real credentials either in ENV vars or shared-credentials files. What do you guys think?/1/
The text was updated successfully, but these errors were encountered: