Merge pull request #1989 from jrbeilke/bugfix-ec2_ami_is-public
Bugfix for filtering EC2 AMIs with is-public (values should be lowercase)
This commit is contained in:
commit
93f68090e3
@ -1115,7 +1115,7 @@ class Ami(TaggedEC2Resource):
|
|||||||
elif filter_name == 'image-id':
|
elif filter_name == 'image-id':
|
||||||
return self.id
|
return self.id
|
||||||
elif filter_name == 'is-public':
|
elif filter_name == 'is-public':
|
||||||
return str(self.is_public)
|
return self.is_public_string
|
||||||
elif filter_name == 'state':
|
elif filter_name == 'state':
|
||||||
return self.state
|
return self.state
|
||||||
elif filter_name == 'name':
|
elif filter_name == 'name':
|
||||||
|
@ -258,11 +258,11 @@ def test_ami_filters():
|
|||||||
amis_by_name = conn.get_all_images(filters={'name': imageA.name})
|
amis_by_name = conn.get_all_images(filters={'name': imageA.name})
|
||||||
set([ami.id for ami in amis_by_name]).should.equal(set([imageA.id]))
|
set([ami.id for ami in amis_by_name]).should.equal(set([imageA.id]))
|
||||||
|
|
||||||
amis_by_public = conn.get_all_images(filters={'is-public': True})
|
amis_by_public = conn.get_all_images(filters={'is-public': 'true'})
|
||||||
set([ami.id for ami in amis_by_public]).should.contain(imageB.id)
|
set([ami.id for ami in amis_by_public]).should.contain(imageB.id)
|
||||||
len(amis_by_public).should.equal(35)
|
len(amis_by_public).should.equal(35)
|
||||||
|
|
||||||
amis_by_nonpublic = conn.get_all_images(filters={'is-public': False})
|
amis_by_nonpublic = conn.get_all_images(filters={'is-public': 'false'})
|
||||||
set([ami.id for ami in amis_by_nonpublic]).should.contain(imageA.id)
|
set([ami.id for ami in amis_by_nonpublic]).should.contain(imageA.id)
|
||||||
len(amis_by_nonpublic).should.equal(1)
|
len(amis_by_nonpublic).should.equal(1)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user