Class: Chef::Provider::LoadBalancer

Inherits:
LWRPBase
  • Object
show all
Defined in:
lib/chef/provider/load_balancer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#lb_specObject (readonly)

Returns the value of attribute lb_spec.



42
43
44
# File 'lib/chef/provider/load_balancer.rb', line 42

def lb_spec
  @lb_spec
end

Instance Method Details

#action_handlerObject



11
12
13
# File 'lib/chef/provider/load_balancer.rb', line 11

def action_handler
  @action_handler ||= Chef::Provisioning::ChefProviderActionHandler.new(self)
end

#create_loadbalancer(lb_spec) ⇒ Object



60
61
62
63
64
# File 'lib/chef/provider/load_balancer.rb', line 60

def create_loadbalancer(lb_spec)
  new_driver.allocate_load_balancer(action_handler, lb_spec, lb_options)
  lb_spec.save(action_handler)
  new_driver.ready_load_balancer(action_handler, lb_spec, lb_options)
end

#new_driverObject



19
20
21
# File 'lib/chef/provider/load_balancer.rb', line 19

def new_driver
  @new_driver ||= run_context.chef_provisioning.driver_for(new_resource.driver)
end

#update_loadbalancer(lb_spec) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/chef/provider/load_balancer.rb', line 45

def update_loadbalancer(lb_spec)
  machines = Hash[
      *(new_resource.machines).collect {
          |machine_name| [machine_name, get_machine_spec(machine_name)]
      }.flatten
  ]
  new_driver.update_load_balancer(action_handler, lb_spec, lb_options, {
            :machines => machines
          }
      )
  lb_spec.load_balancer_options = new_resource.load_balancer_options
  lb_spec.machines = new_resource.machines
  lb_spec.save(action_handler)
end

#whyrun_supported?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/chef/provider/load_balancer.rb', line 15

def whyrun_supported?
  true
end