[ 
https://issues.apache.org/jira/browse/LIBCLOUD-989?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16407773#comment-16407773
 ] 

Vincent Planchenault edited comment on LIBCLOUD-989 at 3/21/18 11:27 AM:
-------------------------------------------------------------------------

[~quentinp] Why not, but I have no idea of what/how to do...

I already have a patch file for libcloud-2.2.1 and libcloud-2.3.0, but for my 
short-term need I've chosen to "Monkey patch" libcloud from my code (I don't 
want to force user of my code to patch libcloud).


was (Author: ctacat):
[~quentinp] Why not, but I have no idea of what/how to do...

I already have a patch file for libcloud-2.2.1 and libcloud-2.3.0, but for my 
short-term need I've chosen to "Monkey patch" libcloud from my code, the idea 
being not to fork libcloud in any way.

> Small bug in common/openstack.py
> --------------------------------
>
>                 Key: LIBCLOUD-989
>                 URL: https://issues.apache.org/jira/browse/LIBCLOUD-989
>             Project: Libcloud
>          Issue Type: Bug
>          Components: Core
>         Environment: Python 2.7
> libcloud 2.3.0
>            Reporter: Vincent Planchenault
>            Priority: Minor
>
> Hello,
> I encountered a small bug in common/openstack.py, when an Openstack 
> compatible french Cloud Provider wanted to tell me I've used its API at a too 
> high rate.
> In this case, the API returned a status 503, with a message composed of 
> fields 'message' and 'request', without 'code' field
> The code in line 393 in common/openstack.py raises in this case a TypeError 
> exception, because there is no 'code' field in the values.
> I changed this line from:
>     if len(values) > 0 and values[0]['code'] == 404 and key_pair_name:
> to:
>     if len(values) > 0 and 'code' in values[0] and values[0]['code'] == 404 
> and key_pair_name:
> Now, it raises a libcloud.exception_from_message I  can handle properly.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to