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

cloudstack: If no volumes are found return an empty list #617

wants to merge 1 commit into from


Copy link

@wido wido commented Oct 28, 2015

Otherwise we got this:

Traceback (most recent call last):
  File "", line 16, in 
  File "/home/wido/repos/libcloud/libcloud/compute/drivers/", line 2172, in list_volumes
    for vol in volumes['volume']:
KeyError: 'volume'

Simply return a empty list if no volume is found

Copy link
Contributor Author

wido commented Oct 29, 2015

@Runseb Can you take a look?

@@ -2168,6 +2168,10 @@ def list_volumes(self, node=None):

list_volumes = []

if 'volume' not in volumes:
Copy link

@Kami Kami Nov 1, 2015

Choose a reason for hiding this comment

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

I would prefer to do for vol in volumes.get('volume', []).

@wido wido force-pushed the cloudstack-list-volumes branch from c9bdb5a to ea68a0b Compare Nov 2, 2015
Copy link
Contributor Author

wido commented Nov 2, 2015

@Kami Yes, that's a nice syntax :) Fixed!

@asfgit asfgit closed this in 0306394 Nov 2, 2015
Copy link

Kami commented Nov 2, 2015

Merged, thanks :)

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