class Chef::Knife::Cloud::OpenstackFloatingIpAssociate

Public Instance Methods

execute_command() click to toggle source
# File lib/chef/knife/openstack_floating_ip_associate.rb, line 38
def execute_command
  if @name_args[0]
    floating_ip = @name_args[0]
  else
    ui.error "Please provide Floating IP to associate with."
    exit 1
  end

  response = @service.associate_address(config[:instance_id], floating_ip)
  if response && response.status == 202
    ui.info "Floating IP #{floating_ip} associated with Instance #{config[:instance_id]}"
  end
end