libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r1071372 - in /incubator/libcloud/trunk: libcloud/drivers/ec2.py test/test_ec2.py
Date Wed, 16 Feb 2011 19:33:43 GMT
Author: tomaz
Date: Wed Feb 16 19:33:42 2011
New Revision: 1071372

URL: http://svn.apache.org/viewvc?rev=1071372&view=rev
Log:
Also include node Elastic IP addresses in the node public_ip attribute.

Modified:
    incubator/libcloud/trunk/libcloud/drivers/ec2.py
    incubator/libcloud/trunk/test/test_ec2.py

Modified: incubator/libcloud/trunk/libcloud/drivers/ec2.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/drivers/ec2.py?rev=1071372&r1=1071371&r2=1071372&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/drivers/ec2.py (original)
+++ incubator/libcloud/trunk/libcloud/drivers/ec2.py Wed Feb 16 19:33:42 2011
@@ -398,6 +398,12 @@ class EC2NodeDriver(NodeDriver):
             groups=[g.findtext('')
                         for g in self._findall(rs, 'groupSet/item/groupId')]
             nodes += self._to_nodes(rs, 'instancesSet/item', groups)
+
+        for node in nodes:
+            elastic_ip_address = self.ex_describe_addresses(node)
+
+            if elastic_ip_address:
+                node.public_ip.extend(elastic_ip_address)
         return nodes
 
     def list_sizes(self, location=None):

Modified: incubator/libcloud/trunk/test/test_ec2.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/test/test_ec2.py?rev=1071372&r1=1071371&r2=1071372&view=diff
==============================================================================
--- incubator/libcloud/trunk/test/test_ec2.py (original)
+++ incubator/libcloud/trunk/test/test_ec2.py Wed Feb 16 19:33:42 2011
@@ -87,8 +87,12 @@ class EC2Tests(unittest.TestCase, TestCa
 
     def test_list_nodes(self):
         node = self.driver.list_nodes()[0]
+        public_ips = sorted(node.public_ip)
         self.assertEqual(node.id, 'i-4382922a')
-        self.assertEqual(len(node.public_ip), 1)
+        self.assertEqual(len(node.public_ip), 2)
+
+        self.assertEqual(public_ips[0], '1.2.3.4')
+        self.assertEqual(public_ips[1], '1.2.3.5')
 
     def test_list_location(self):
         locations = self.driver.list_locations()



Mime
View raw message