Class: Chef::Knife::Cloud::OpenstackFloatingIpAllocate

Inherits:
Command
  • Object
show all
Includes:
OpenstackHelpers, OpenstackServiceOptions
Defined in:
lib/chef/knife/openstack_floating_ip_allocate.rb

Instance Method Summary collapse

Methods included from OpenstackServiceOptions

included

Methods included from OpenstackHelpers

#create_service_instance, #instance_addresses, #primary_network_ip_address, #primary_private_ip_address, #primary_public_ip_address, #validate!

Instance Method Details

#after_exec_commandObject



41
42
43
44
45
46
47
48
49
# File 'lib/chef/knife/openstack_floating_ip_allocate.rb', line 41

def after_exec_command
  @columns_with_info = [{ label: "ID", value: @resource["floating_ip"]["id"].to_s },
                        { label: "Instance ID", value: @resource["floating_ip"]["instance_id"].to_s },
                        { label: "Floating IP", value: @resource["floating_ip"]["ip"].to_s },
                        { label: "Fixed IP", value: @resource["floating_ip"]["fixed_ip"].to_s },
                        { label: "Pool", value: @resource["floating_ip"]["pool"].to_s },
                       ]
  @service.server_summary(nil, @columns_with_info)
end

#execute_commandObject



37
38
39
# File 'lib/chef/knife/openstack_floating_ip_allocate.rb', line 37

def execute_command
  @resource = @service.allocate_address(config[:pool])
end