Changed the code based on suggestions from tonybaloney Closes #725
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/ac4a8c1b Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/ac4a8c1b Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/ac4a8c1b Branch: refs/heads/trunk Commit: ac4a8c1b0cac0c217c7fc1c8a835b575ba130cf5 Parents: e0cb51b Author: marko_praprotnik <praprtm65> Authored: Tue Mar 22 13:08:21 2016 +0100 Committer: anthony-shaw <[email protected]> Committed: Tue Mar 22 20:56:25 2016 +1100 ---------------------------------------------------------------------- libcloud/compute/drivers/openstack.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/ac4a8c1b/libcloud/compute/drivers/openstack.py ---------------------------------------------------------------------- diff --git a/libcloud/compute/drivers/openstack.py b/libcloud/compute/drivers/openstack.py index 8c3bce7..c775603 100644 --- a/libcloud/compute/drivers/openstack.py +++ b/libcloud/compute/drivers/openstack.py @@ -2323,13 +2323,10 @@ class OpenStack_1_1_NodeDriver(OpenStackNodeDriver): :rtype: :class:`OpenStack_1_1_FloatingIpAddress` """ - if (ip_pool is None) and (len(self.ex_list_floating_ip_pools()) == 1): - ip_pool = self.ex_list_floating_ip_pools()[0].name - elif (ip_pool is None) and (len(self.ex_list_floating_ip_pools()) > 1): - return None + data = {'pool': ip_pool} if ip_pool is not None else {} resp = self.connection.request('/os-floating-ips', method='POST', - data={'pool': ip_pool}) + data=data) data = resp.object['floating_ip'] id = data['id']
