Skip to content

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

Closed
wido wants to merge 1 commit into
apache:trunkfrom
wido:cloudstack-list-volumes
Closed

cloudstack: If no volumes are found return an empty list#617
wido wants to merge 1 commit into
apache:trunkfrom
wido:cloudstack-list-volumes

Conversation

@wido

@wido wido commented Oct 28, 2015

Copy link
Copy Markdown
Contributor

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

wido commented Oct 29, 2015

Copy link
Copy Markdown
Contributor Author

@Runseb Can you take a look?

Comment thread libcloud/compute/drivers/cloudstack.py Outdated

Copy link
Copy Markdown
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

wido commented Nov 2, 2015

Copy link
Copy Markdown
Contributor Author

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

@asfgit asfgit closed this in 0306394 Nov 2, 2015
@Kami

Kami commented Nov 2, 2015

Copy link
Copy Markdown
Member

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