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 2011/05/10 04:13:45 UTC

svn commit: r1101288 - /incubator/libcloud/trunk/libcloud/compute/drivers/slicehost.py

Author: tomaz
Date: Tue May 10 02:13:45 2011
New Revision: 1101288

URL: http://svn.apache.org/viewvc?rev=1101288&view=rev
Log:
Fix a bug with primary IP address handling in the Slicehost driver. Slicehost
API sometimes returns internal IP as a primary address and we added this IP to
the public_ip instead of private_ip list.

Modified:
    incubator/libcloud/trunk/libcloud/compute/drivers/slicehost.py

Modified: incubator/libcloud/trunk/libcloud/compute/drivers/slicehost.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/compute/drivers/slicehost.py?rev=1101288&r1=1101287&r2=1101288&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/compute/drivers/slicehost.py (original)
+++ incubator/libcloud/trunk/libcloud/compute/drivers/slicehost.py Tue May 10 02:13:45 2011
@@ -183,9 +183,15 @@ class SlicehostNodeDriver(NodeDriver):
 
         # slicehost does not determine between public and private, so we
         # have to figure it out
-        primary_ip = element.findtext('ip-address')
         public_ip = []
         private_ip = []
+
+        ip_address = element.findtext('ip-address')
+        if is_private_subnet(ip_address):
+            private_ip.append(ip_address)
+        else:
+            public_ip.append(ip_address)
+
         for addr in element.findall('addresses/address'):
             ip = addr.text
             try:
@@ -198,8 +204,6 @@ class SlicehostNodeDriver(NodeDriver):
             else:
                 public_ip.append(ip)
 
-        public_ip.append(primary_ip)
-
         public_ip = list(set(public_ip))
 
         try: