Class: KnifePlugins::RackspaceLoadBalancerDelete

Inherits:
Chef::Knife
  • Object
show all
Includes:
Chef::Knife::RackspaceBase, Chef::Knife::RackspaceLoadBalancerBase
Defined in:
lib/chef/knife/rackspace_load_balancer_delete.rb

Instance Method Summary collapse

Methods included from Chef::Knife::RackspaceLoadBalancerBase

included, #lb_connection, #rackspace_api_credentials

Instance Method Details

#runObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/chef/knife/rackspace_load_balancer_delete.rb', line 23

def run
  @name_args.each do |load_balancer_id|
    show_load_balancer = RackspaceLoadBalancerShow.new
    show_load_balancer.config[:resolve_node_names] = true if config[:resolve_node_names]
    show_load_balancer.name_args = [load_balancer_id]
    show_load_balancer.run

    unless config[:force]
      ui.confirm("Do you really want to delete this load balancer")
    end

    load_balancer = lb_connection.get_load_balancer(load_balancer_id)
    load_balancer.destroy!

    ui.warn("Deleted load balancer #{load_balancer_id}")
  end
end