lib/chef/knife/openstack_server_create.rb in knife-openstack-1.0.0.rc1 vs lib/chef/knife/openstack_server_create.rb in knife-openstack-1.0.0.rc2
- old
+ new
@@ -102,11 +102,11 @@
raise e
end
end
# Pull the port_id for the associate_floating_ip
- port_id = @service.network.list_ports[:body].flatten.flatten[1]["id"]
- fixed_ip_address = @service.network.list_ports[:body].flatten.flatten[1]["fixed_ips"].flatten[0]["ip_address"]
+ port_id = @service.network.list_ports[:body]['ports'].find {|x| x['fixed_ips'][0]['ip_address'] == bind_ip}['id']
+ fixed_ip_address = service.network.list_ports[:body]["ports"].find {|x| x['id'] == port_id}['fixed_ips'][0]["ip_address"]
floating_ip_id = get_floating_ip_id(floating_address)
# Associate the floating ip via the neutron/network api
@service.network.associate_floating_ip(floating_ip_id, port_id, options = {:fixed_ip_address => fixed_ip_address })