Skip to content

Commit

Permalink
Merge pull request #4 from ohlol/master
Browse files Browse the repository at this point in the history
fix attach_ip
  • Loading branch information
jkeiser committed Apr 15, 2014
2 parents 1e8cedc + 42dbd44 commit 5c3c038
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/chef_metal_fog/fog_provisioner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def acquire_machine(action_handler, node)
Chef::Log.info 'Attaching given IP'
server.wait_for { ready? }
action_handler.perform_action "attach floating IP #{bootstrap_options[:floating_ip]}" do
attach_ip(server, bootstrap_options[:floating_ip])
attach_ip(server, bootstrap_options[:allocation_id], bootstrap_options[:floating_ip])
end
end
action_handler.perform_action "machine #{node['name']} created as #{server.id} on #{provisioner_url}" do
Expand Down Expand Up @@ -301,9 +301,11 @@ def attach_ip_from_pool(server, pool)
# Attach given IP to machine
# Code taken from kitchen-openstack driver
# https://github.com/test-kitchen/kitchen-openstack/blob/master/lib/kitchen/driver/openstack.rb#L209-L213
def attach_ip(server, ip)
def attach_ip(server, allocation_id, ip)
Chef::Log.info "Attaching floating IP <#{ip}>"
server.associate_address ip
compute.associate_address(:instance_id => server.id,
:allocation_id => allocation_id
:public_ip => ip)
(server.addresses['public'] ||= []) << { 'version' => 4, 'addr' => ip }
end

Expand Down

0 comments on commit 5c3c038

Please sign in to comment.