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 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:
Copy link
Member

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 November 2, 2015 08:44
@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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants