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: fix in parsing of an empty body #555

Closed
wants to merge 3 commits into
base: trunk
from

Conversation

Projects
None yet
2 participants
@konstan
Contributor

konstan commented Jul 29, 2015

Fix for the issue when AttributeError: 'str' object has no attribute 'values' gets thrown in case of an empty body is retuned by the provider.

Traceback (most recent call last):
...
  File "/usr/lib/python2.6/site-packages/libcloud/compute/drivers/cloudstack.py", line 1089, in list_sizes
    method='GET')
  File "/usr/lib/python2.6/site-packages/libcloud/common/cloudstack.py", line 188, in _sync_request
    headers=headers, method=method)
  File "/usr/lib/python2.6/site-packages/libcloud/common/cloudstack.py", line 152, in _sync_request
    data=data, headers=headers, method=method)
  File "/usr/lib/python2.6/site-packages/libcloud/common/base.py", line 736, in request
    response = responseCls(**kwargs)
  File "/usr/lib/python2.6/site-packages/libcloud/common/base.py", line 117, in __init__
    raise Exception(self.parse_error())
  File "/usr/lib/python2.6/site-packages/libcloud/common/cloudstack.py", line 39, in parse_error
    values = list(body.values())[0]
AttributeError: 'str' object has no attribute 'values'

Exception after the change:

  File "/usr/lib/python2.6/site-packages/libcloud/common/cloudstack.py", line 188, in _sync_request
    headers=headers, method=method)
  File "/usr/lib/python2.6/site-packages/libcloud/common/cloudstack.py", line 152, in _sync_request
    data=data, headers=headers, method=method)
  File "/usr/lib/python2.6/site-packages/libcloud/common/base.py", line 736, in request
    response = responseCls(**kwargs)
  File "/usr/lib/python2.6/site-packages/libcloud/common/base.py", line 117, in __init__
    raise Exception(self.parse_error())
  File "/usr/lib/python2.6/site-packages/libcloud/common/cloudstack.py", line 48, in parse_error
    raise error
libcloud.common.types.ProviderError: 'WARNING: error message text sent by provider was empty.'
@Kami

This comment has been minimized.

Show comment
Hide comment
@Kami

Kami Aug 1, 2015

Member

Thanks, the change looks good, but can you please also add a test case for it?

Member

Kami commented Aug 1, 2015

Thanks, the change looks good, but can you please also add a test case for it?

@Kami

This comment has been minimized.

Show comment
Hide comment
@Kami

Kami Aug 3, 2015

Member

@konstan bump^^

Member

Kami commented Aug 3, 2015

@konstan bump^^

@asfgit asfgit closed this in 9e5eb41 Aug 8, 2015

@Kami

This comment has been minimized.

Show comment
Hide comment
@Kami

Kami Aug 8, 2015

Member

I'm working on a 0.18.0 release so I merged patch into trunk.

Please make sure to submit a new PR with the corresponding tests when you have a chance.

Thanks.

Member

Kami commented Aug 8, 2015

I'm working on a 0.18.0 release so I merged patch into trunk.

Please make sure to submit a new PR with the corresponding tests when you have a chance.

Thanks.

@konstan

This comment has been minimized.

Show comment
Hide comment
@konstan

konstan Aug 9, 2015

Contributor

Oops... Sorry for not replying promptly (vacations time). Yes, sure - next time with a test! Thanks for the merge.

Contributor

konstan commented Aug 9, 2015

Oops... Sorry for not replying promptly (vacations time). Yes, sure - next time with a test! Thanks for the merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment