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
base: trunk
from

Conversation

Projects
None yet
2 participants
@wido
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

This comment has been minimized.

Show comment
Hide comment
@wido

wido Oct 29, 2015

Contributor

@runseb Can you take a look?

Contributor

wido commented Oct 29, 2015

@runseb Can you take a look?

Show outdated Hide outdated libcloud/compute/drivers/cloudstack.py
@@ -2168,6 +2168,10 @@ def list_volumes(self, node=None):
method='GET')
list_volumes = []
if 'volume' not in volumes:

This comment has been minimized.

@Kami

Kami Nov 1, 2015

Member

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

@Kami

Kami Nov 1, 2015

Member

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

@wido

This comment has been minimized.

Show comment
Hide comment
@wido

wido Nov 2, 2015

Contributor

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

Contributor

wido commented Nov 2, 2015

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

@asfgit asfgit closed this in 0306394 Nov 2, 2015

@Kami

This comment has been minimized.

Show comment
Hide comment
@Kami

Kami Nov 2, 2015

Member

Merged, thanks :)

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