Skip to content

CloudStack: fix in parsing of an empty body#555

Closed
konstan wants to merge 3 commits intoapache:trunkfrom
konstan:trunk
Closed

CloudStack: fix in parsing of an empty body#555
konstan wants to merge 3 commits intoapache:trunkfrom
konstan:trunk

Conversation

@konstan
Copy link
Contributor

@konstan 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
Copy link
Member

Kami commented Aug 1, 2015

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

@Kami
Copy link
Member

Kami commented Aug 3, 2015

@konstan bump^^

@asfgit asfgit closed this in 9e5eb41 Aug 8, 2015
@Kami
Copy link
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
Copy link
Contributor Author

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants