libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r1201117 - in /libcloud/trunk: CHANGES libcloud/compute/base.py libcloud/compute/drivers/ibm_sbc.py test/compute/test_ibm_sbc.py
Date Sat, 12 Nov 2011 00:20:49 GMT
Author: tomaz
Date: Sat Nov 12 00:20:48 2011
New Revision: 1201117

URL: http://svn.apache.org/viewvc?rev=1201117&view=rev
Log:
Make sure public_ips and private_ips attributes are always a list. Also fix an
inconsistency in IBM SBC driver and make sure those two attributes are a list.

Modified:
    libcloud/trunk/CHANGES
    libcloud/trunk/libcloud/compute/base.py
    libcloud/trunk/libcloud/compute/drivers/ibm_sbc.py
    libcloud/trunk/test/compute/test_ibm_sbc.py

Modified: libcloud/trunk/CHANGES
URL: http://svn.apache.org/viewvc/libcloud/trunk/CHANGES?rev=1201117&r1=1201116&r2=1201117&view=diff
==============================================================================
--- libcloud/trunk/CHANGES (original)
+++ libcloud/trunk/CHANGES Sat Nov 12 00:20:48 2011
@@ -23,6 +23,10 @@ Changes with Apache Libcloud in developm
        private_ip attributes, but this will be removed in the next release.
        [Tomaz Muraus]
 
+     - Fix an inconsistency in IBM SBC driver and make sure public_ips and
+       private_ips attributes are a list.
+       [Tomaz Muraus]
+
   *) Storage:
 
      - Update Amazon S3 driver to support a new region - US West 2 (Oregon)

Modified: libcloud/trunk/libcloud/compute/base.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/base.py?rev=1201117&r1=1201116&r2=1201117&view=diff
==============================================================================
--- libcloud/trunk/libcloud/compute/base.py (original)
+++ libcloud/trunk/libcloud/compute/base.py Sat Nov 12 00:20:48 2011
@@ -114,8 +114,8 @@ class Node(object):
         self.id = str(id) if id else None
         self.name = name
         self.state = state
-        self.public_ips = public_ips
-        self.private_ips = private_ips
+        self.public_ips = public_ips if public_ips else []
+        self.private_ips = private_ips if private_ips else []
         self.driver = driver
         self.uuid = self.get_uuid()
         self.size = size

Modified: libcloud/trunk/libcloud/compute/drivers/ibm_sbc.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/drivers/ibm_sbc.py?rev=1201117&r1=1201116&r2=1201117&view=diff
==============================================================================
--- libcloud/trunk/libcloud/compute/drivers/ibm_sbc.py (original)
+++ libcloud/trunk/libcloud/compute/drivers/ibm_sbc.py Sat Nov 12 00:20:48 2011
@@ -139,7 +139,7 @@ class IBMNodeDriver(NodeDriver):
     def list_images(self, location = None):
         return self._to_images(self.connection.request(REST_BASE + '/offerings/image').object)
 
-    def list_sizes(self, location = None):        
+    def list_sizes(self, location = None):
         return [ NodeSize('BRZ32.1/2048/60*175', 'Bronze 32 bit', None, None, None, None,
self.connection.driver),
                  NodeSize('BRZ64.2/4096/60*500*350', 'Bronze 64 bit', None, None, None, None,
self.connection.driver),
                  NodeSize('COP32.1/2048/60', 'Copper 32 bit', None, None, None, None, self.connection.driver),
@@ -157,11 +157,17 @@ class IBMNodeDriver(NodeDriver):
         return [ self._to_node(instance) for instance in object.findall('Instance') ]
 
     def _to_node(self, instance):
+        public_ips = []
+
+        ip = instance.findtext('IP')
+        if ip:
+            public_ips.append(ip)
+
         return Node(id = instance.findtext('ID'),
                     name = instance.findtext('Name'),
                     state = self.NODE_STATE_MAP[int(instance.findtext('Status'))],
-                    public_ips = instance.findtext('IP'),
-                    private_ips = None,
+                    public_ips = public_ips,
+                    private_ips = [],
                     driver = self.connection.driver)
 
     def _to_images(self, object):

Modified: libcloud/trunk/test/compute/test_ibm_sbc.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_ibm_sbc.py?rev=1201117&r1=1201116&r2=1201117&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_ibm_sbc.py (original)
+++ libcloud/trunk/test/compute/test_ibm_sbc.py Sat Nov 12 00:20:48 2011
@@ -50,10 +50,10 @@ class IBMTests(unittest.TestCase, TestCa
         self.assertEquals(len(ret), 3)
         self.assertEquals(ret[0].id, '26557')
         self.assertEquals(ret[0].name, 'Insight Instance')
-        self.assertEquals(ret[0].public_ips, '129.33.196.128')
-        self.assertEquals(ret[0].private_ips, None)  # Private IPs not supported
-        self.assertEquals(ret[1].public_ips, None)   # Node is non-active (no IP)
-        self.assertEquals(ret[1].private_ips, None)
+        self.assertEquals(ret[0].public_ips, ['129.33.196.128'])
+        self.assertEquals(ret[0].private_ips, [])  # Private IPs not supported
+        self.assertEquals(ret[1].public_ips, [])   # Node is non-active (no IP)
+        self.assertEquals(ret[1].private_ips, [])
         self.assertEquals(ret[1].id, '28193')
 
     def test_list_sizes(self):



Mime
View raw message