Repository: libcloud
Updated Branches:
  refs/heads/trunk 33ca3b2e6 -> f8c1a1646


Fix floating IP initialization

The OpenStack_1_1_FloatingIpAddress constructor was called incorrectly: "self"
was passed as "pool" instead of "driver".

Closes #310

Signed-off-by: Tomaz Muraus <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/f8c1a164
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/f8c1a164
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/f8c1a164

Branch: refs/heads/trunk
Commit: f8c1a1646dccb885fda10c6de29fad0585802bd1
Parents: 33ca3b2
Author: Csaba Hoch <[email protected]>
Authored: Wed Jun 4 13:37:02 2014 +0200
Committer: Tomaz Muraus <[email protected]>
Committed: Sun Jun 15 17:23:46 2014 +0200

----------------------------------------------------------------------
 libcloud/compute/drivers/openstack.py | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/f8c1a164/libcloud/compute/drivers/openstack.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/openstack.py 
b/libcloud/compute/drivers/openstack.py
index fd116e8..1788479 100644
--- a/libcloud/compute/drivers/openstack.py
+++ b/libcloud/compute/drivers/openstack.py
@@ -2184,8 +2184,11 @@ class OpenStack_1_1_NodeDriver(OpenStackNodeDriver):
         return [self._to_floating_ip(ip) for ip in ip_elements]
 
     def _to_floating_ip(self, obj):
-        return OpenStack_1_1_FloatingIpAddress(obj['id'], obj['ip'], self,
-                                               obj['instance_id'])
+        return OpenStack_1_1_FloatingIpAddress(id=obj['id'],
+                                               ip_address=obj['ip'],
+                                               pool=None,
+                                               node_id=obj['instance_id'],
+                                               driver=self)
 
     def ex_list_floating_ips(self):
         """
@@ -2221,7 +2224,11 @@ class OpenStack_1_1_NodeDriver(OpenStackNodeDriver):
         data = resp.object['floating_ip']
         id = data['id']
         ip_address = data['ip']
-        return OpenStack_1_1_FloatingIpAddress(id, ip_address, self)
+        return OpenStack_1_1_FloatingIpAddress(id=id,
+                                               ip_address=ip_address,
+                                               pool=None,
+                                               node_id=None,
+                                               driver=self)
 
     def ex_delete_floating_ip(self, ip):
         """
@@ -2337,8 +2344,11 @@ class OpenStack_1_1_FloatingIpPool(object):
         return [self._to_floating_ip(ip) for ip in ip_elements]
 
     def _to_floating_ip(self, obj):
-        return OpenStack_1_1_FloatingIpAddress(obj['id'], obj['ip'], self,
-                                               obj['instance_id'])
+        return OpenStack_1_1_FloatingIpAddress(id=obj['id'],
+                                               ip_address=obj['ip'],
+                                               pool=self,
+                                               node_id=obj['instance_id'],
+                                               driver=self.connection.driver)
 
     def get_floating_ip(self, ip):
         """
@@ -2364,7 +2374,11 @@ class OpenStack_1_1_FloatingIpPool(object):
         data = resp.object['floating_ip']
         id = data['id']
         ip_address = data['ip']
-        return OpenStack_1_1_FloatingIpAddress(id, ip_address, self)
+        return OpenStack_1_1_FloatingIpAddress(id=id,
+                                               ip_address=ip_address,
+                                               pool=self,
+                                               node_id=None,
+                                               driver=self.connection.driver)
 
     def delete_floating_ip(self, ip):
         """

Reply via email to