Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LIBCLOUD-554] Add support for providing filters and VPC IDs to EC2: ex_list_networks() #294

wants to merge 3 commits into from


Copy link

EC2 API allows VPC ID and filters to be provided to list only specific VPCs.
Add support for specifying filters and vpc ids when listing networks (vpc's) with ec2 driver's method ex_list_networks()

:rtype: ``list`` of :class:`EC2Network`
params = {'Action': 'DescribeVpcs'}

if network_ids is not None:
for network_idx, network_id in enumerate(network_ids, 1):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still support Python 2.5 which doesn't support second argument (start) to enumerate function so you need to do it like this -

Copy link

Kami commented May 16, 2014

Adding some tests for this new functionality would be good.

Copy link
Contributor Author

Something is wrong with the tests:

Providing VPC IDs and filters returns correct number of matching objects when working with EC2 API. In tests the calls return all objects in the fixture (ignores the filter)

Please advice!

@asfgit asfgit closed this in 819f167 May 20, 2014
Copy link

Kami commented May 20, 2014

I went ahead, squashed the commits, fixed the tests and merged changes into trunk.

The problem in your case was that you asserted on the response, but you returned the same fixture which contains all the networks. I've changed the tests to assert that the correct query parameters are sent, because that's the thing we are actually interested in and want to test in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants