You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2012/02/02 21:17:38 UTC
svn commit: r1239804 - in /libcloud/trunk: libcloud/compute/drivers/gandi.py
test/compute/test_gandi.py
Author: tomaz
Date: Thu Feb 2 20:17:37 2012
New Revision: 1239804
URL: http://svn.apache.org/viewvc?rev=1239804&view=rev
Log:
Fix a public_ips assignment in the Gande.net compute driver. This patch has been
submitted by Aymeric Barantal <mric at gandi dot net> and is part of LIBCLOUD-147.
Modified:
libcloud/trunk/libcloud/compute/drivers/gandi.py
libcloud/trunk/test/compute/test_gandi.py
Modified: libcloud/trunk/libcloud/compute/drivers/gandi.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/drivers/gandi.py?rev=1239804&r1=1239803&r2=1239804&view=diff
==============================================================================
--- libcloud/trunk/libcloud/compute/drivers/gandi.py (original)
+++ libcloud/trunk/libcloud/compute/drivers/gandi.py Thu Feb 2 20:17:37 2012
@@ -15,6 +15,7 @@
"""
Gandi driver for compute
"""
+import sys
from datetime import datetime
from libcloud.common.gandi import BaseGandiDriver, GandiException, \
@@ -68,7 +69,7 @@ class GandiNodeDriver(BaseGandiDriver, N
vm['state'],
NodeState.UNKNOWN
),
- public_ips=vm.get('ip'),
+ public_ips=vm.get('ips', []),
private_ips=[],
driver=self,
extra={
@@ -85,9 +86,12 @@ class GandiNodeDriver(BaseGandiDriver, N
vms = self.connection.request('vm.list')
ips = self.connection.request('ip.list')
for vm in vms:
+ vm['ips'] = []
for ip in ips:
if vm['ifaces_id'][0] == ip['iface_id']:
- vm['ip'] = ip.get('ip')
+ ip = ip.get('ip', None)
+ if ip:
+ vm['ips'].append(ip)
nodes = self._to_nodes(vms)
return nodes
Modified: libcloud/trunk/test/compute/test_gandi.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_gandi.py?rev=1239804&r1=1239803&r2=1239804&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_gandi.py (original)
+++ libcloud/trunk/test/compute/test_gandi.py Thu Feb 2 20:17:37 2012
@@ -59,6 +59,7 @@ class GandiTests(unittest.TestCase):
def test_list_nodes(self):
nodes = self.driver.list_nodes()
self.assertTrue(len(nodes) > 0)
+ self.assertTrue(len(nodes[0].public_ips) > 1)
def test_list_locations(self):
loc = list(filter(lambda x: 'france' in x.country.lower(),