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

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

GitHub user SElsharkawy opened a pull request:

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

    LIBCLOUD-926 - Propagated changes to azure_arm.py from pull 1051

    ## Changes Title (Update: LIBCLOUD-926 - [BUG Azure_ARM] in 
ex_create_public_ip function among other)
    
    ### Description
    
    This suggested update fixes the condition that checks for parameter 
"location" being None. If the parameter is not None, the original code would 
still exit and raise ValueError exception.
    
    In the file libcloud/compute/drivers/azure_arm.py.
    There are some functions as ex_create_public_ip function that it needs a 
location parameter, when this parameter is send, a error happen: "Location is 
required".
    Looking at the code I found with the following:
    
           if location is None and self.default_location:
                location = self.default_location
            else:
                raise ValueError("location is required.")
    This does not evaluate a possible parameter, only if the value is None.
    
    I suggested the following change:
    
            if location is None:
                if self.default_location:
                    location = self.default_location
                else:
                    raise ValueError("location is required.")
    The affected methods are:
    
       ex_create_network_security_group
       ex_delete_network_security_group
       ex_create_public_ip
    The same code has been used in several other places.
    
    ### Status
    
    done, ready for review
    
    ### Checklist (tick everything that applies)
    
    - [ ] [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/SElsharkawy/libcloud LIBCLOUD-926_pull-1051

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

    https://github.com/apache/libcloud/pull/1098.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 #1098
    
----
commit adadaf53882d6e15500079debc7344e5e2d28049
Author: Elsharkawy, Sameh <selshark...@card.core>
Date:   2017-08-29T18:18:19Z

    Propagated changes to azure_arm.py from pull 1051

----


> [BUG Azure_ARM] in ex_create_public_ip function among other
> -----------------------------------------------------------
>
>                 Key: LIBCLOUD-926
>                 URL: https://issues.apache.org/jira/browse/LIBCLOUD-926
>             Project: Libcloud
>          Issue Type: Bug
>          Components: Compute
>            Reporter: Cristina Guerra
>              Labels: azurecompute-arm, compute
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> In the file libcloud/compute/drivers/azure_arm.py.
> There are some functions as ex_create_public_ip function that it needs a 
> location parameter, when this parameter is send, a error happen:  "Location 
> is required".
> Looking at the code I found with the following:
> {code:python}
>        if location is None and self.default_location:
>             location = self.default_location
>         else:
>             raise ValueError("location is required.")
> {code}
> This does not evaluate a possible parameter, only if the value is None.
> I propose:
> {code:python}
>         if location is None and self.default_location:
>             location = self.default_location
>         elif location is not None:
>             location = location
>         else:
>             raise ValueError("location is required.")
> {code}



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

Reply via email to