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

ASF GitHub Bot commented on LIBCLOUD-925:
-----------------------------------------

GitHub user micafer opened a pull request:

    https://github.com/apache/libcloud/pull/1074

    Fix #LIBCLOUD-925

    ## Fixex an error in _get_error function in GCE driver.
    
    ### Description
    Fixes an error in _get_error function in common/google.py file that assumes 
that the body['error'] value is a dict, but in some cases it contains an string 
(unicode).
    So it tries to do a err.get and it failts.
    
    ### Status
    done, ready for review
    
    ### Checklist (tick everything that applies)
    
    - [X] [Code 
linting](http://libcloud.readthedocs.org/en/latest/development.html#code-style-guide)
 (required, can be done after the PR checks)
    - [ ] Documentation
    - [ ] [Tests](http://libcloud.readthedocs.org/en/latest/testing.html)
    - [ ] 
[ICLA](http://libcloud.readthedocs.org/en/latest/development.html#contributing-bigger-changes)
 (required for bigger changes)


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/micafer/libcloud trunk

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/libcloud/pull/1074.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1074
    
----
commit 814bc3e366bdce7f2b935eeb3c7ed21d562cf3e8
Author: micafer <[email protected]>
Date:   2017-06-20T06:21:37Z

    Fix #LIBCLOUD-925

----


> Error in GCE driver in function _get_error
> ------------------------------------------
>
>                 Key: LIBCLOUD-925
>                 URL: https://issues.apache.org/jira/browse/LIBCLOUD-925
>             Project: Libcloud
>          Issue Type: Bug
>            Reporter: Miguel Caballer
>            Priority: Minor
>              Labels: gce
>
> _get_error function assumes that the body['error'] value is a dict, but in 
> some cases it contains an string (unicode).
> So it tries to do a err.get and it failts.
> I has to be something like that:
> {noformat}
>         if 'code' in err:
>             code = err.get('code')
>             message = err.get('message')
>         else:
>             code = None
>             if 'reason' in err:
>                 code = err.get('reason')
>             message = body.get('error_description', err)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to