libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Quentin Pradet (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LIBCLOUD-989) Small bug in common/openstack.py
Date Wed, 21 Mar 2018 17:26:00 GMT

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

Quentin Pradet commented on LIBCLOUD-989:
-----------------------------------------


The first thing to do would be to run the tests locally:

 * git clone https://github.com/apache/libcloud.git
 * cd libcloud
 * pip install -r requirements-test.txt
 * cp libcloud/test/secrets.py-dist libcloud/test/secrets.py
 * pytest

When you'll be working on the OpenStack tests, running `pytest -k openstack` will be faster.

The next step is to understand how the test fixtures work. Here's an example for another driver:
https://github.com/apache/libcloud/pull/1157#issuecomment-355883772

Next we'll need to write a test that fails without your changes, and succeeds with your changes.
Try to come up with a way to do this by looking at the existing steps maybe?

If you're stuck, make sure to ask questions!

Thanks

> 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)

Mime
View raw message