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

Closed
wants to merge 1 commit into from

Conversation

@wido
Copy link
Contributor

wido commented Oct 28, 2015

Otherwise we got this:

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

Simply return a empty list if no volume is found

@wido
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):
method='GET')

list_volumes = []

if 'volume' not in volumes:

This comment has been minimized.

Copy link
@Kami

Kami Nov 1, 2015

Member

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

@wido wido force-pushed the wido:cloudstack-list-volumes branch from c9bdb5a to ea68a0b Nov 2, 2015
@wido
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
@Kami
Copy link
Member

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
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.