You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by marcinzaremba <gi...@git.apache.org> on 2015/07/22 12:46:02 UTC
[GitHub] libcloud pull request: GCE[ex_create_route] By default let's assum...
GitHub user marcinzaremba opened a pull request:
https://github.com/apache/libcloud/pull/552
GCE[ex_create_route] By default let's assume if next_hop is not a string it's a Node object
As far my knowledge is concerned it is impossible to reach the else part of the whole next_hop in a sensible way.
For example (commented):
```
if next_hop is None:
url = 'https://www.googleapis.com/compute/%s/projects/%s/%s' % (
API_VERSION, self.project,
"global/gateways/default-internet-gateway")
route_data['nextHopGateway'] = url
elif isinstance(next_hop, str): # if it is string, assume it's an IP address
route_data['nextHopIp'] = next_hop
else: # what object is expected here? next_hop param there should be string or sth that evaluates to string
node = self.ex_get_node(next_hop)
route_data['nextHopInstance'] = node.extra['selfLink']
```
Even if you pass ``Node`` object to ``next_hop`` param it evaluates to object representation not the node name itself what is expected.
Even tried to pass some Dummy node object that evaluates to a node name in a string context but it failed on finding proper zone ``_find_zone_or_region`` because ``name`` param is a string explicitly needed here ```if res['name'] == name:```. When change to ``str(name)`` worked properly.
In my opinion more sensible choice would be to assume that when ``next_hop`` is not a string it is a ``Node`` object and it can be achieved with deleting just one line.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/marcinzaremba/libcloud trunk
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/libcloud/pull/552.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 #552
----
commit 53a4cf575e409aff6780f6ab80ff55768f5333ce
Author: Marcin Zaremba <mz...@egnyte.com>
Date: 2015-07-22T10:37:14Z
By default let's assume if it's not string it's a Node object
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] libcloud pull request: GCE[ex_create_route] By default let's assum...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/libcloud/pull/552
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---