Class: Chef::Provisioning::LoadBalancerSpec

Inherits:
Object
  • Object
show all
Defined in:
lib/chef/provisioning/load_balancer_spec.rb

Overview

Specification for a machine. Sufficient information to find and contact it after it has been set up.

TODO: This is pretty similar to image_spec, generalize this.

Direct Known Subclasses

ChefLoadBalancerSpec

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(load_balancer_data) ⇒ LoadBalancerSpec

Returns a new instance of LoadBalancerSpec.



9
10
11
12
13
14
15
# File 'lib/chef/provisioning/load_balancer_spec.rb', line 9

def initialize(load_balancer_data)
  @load_balancer_data = load_balancer_data
  # Upgrade from metal to chef_provisioning ASAP.
  if @load_balancer_data['normal'] && !@load_balancer_data['normal']['chef_provisioning'] && @load_balancer_data['normal']['metal']
    @load_balancer_data['normal']['chef_provisioning'] = @load_balancer_data['normal'].delete('metal')
  end
end

Instance Attribute Details

#load_balancer_dataObject (readonly)

Returns the value of attribute load_balancer_data.



17
18
19
# File 'lib/chef/provisioning/load_balancer_spec.rb', line 17

def load_balancer_data
  @load_balancer_data
end

#machinesObject

Returns the value of attribute machines.



18
19
20
# File 'lib/chef/provisioning/load_balancer_spec.rb', line 18

def machines
  @machines
end

Instance Method Details

#driver_urlObject

URL to the driver. Convenience for location



64
65
66
# File 'lib/chef/provisioning/load_balancer_spec.rb', line 64

def driver_url
  location ? location['driver_url'] : nil
end

#idObject

Globally unique identifier for this machine. Does not depend on the machine’s location or existence.



24
25
26
# File 'lib/chef/provisioning/load_balancer_spec.rb', line 24

def id
  raise "id unimplemented"
end

#load_balancer_optionsObject



55
56
57
# File 'lib/chef/provisioning/load_balancer_spec.rb', line 55

def load_balancer_options
  load_balancer_data['load_balancer_options']
end

#load_balancer_options=(value) ⇒ Object



59
60
61
# File 'lib/chef/provisioning/load_balancer_spec.rb', line 59

def load_balancer_options=(value)
  load_balancer_data['load_balancer_options'] = value
end

#locationObject

Location of this machine. This should be a freeform hash, with enough information for the driver to look it up and create a Machine object to access it.

This MUST include a ‘driver_url’ attribute with the driver’s URL in it.

chef-provisioning will do its darnedest to not lose this information.



44
45
46
# File 'lib/chef/provisioning/load_balancer_spec.rb', line 44

def location
  load_balancer_data['location']
end

#location=(value) ⇒ Object

Set the location for this machine.



51
52
53
# File 'lib/chef/provisioning/load_balancer_spec.rb', line 51

def location=(value)
  load_balancer_data['location'] =  value
end

#nameObject

Name of the machine. Corresponds to the name in “machine ‘name’ do” …



31
32
33
# File 'lib/chef/provisioning/load_balancer_spec.rb', line 31

def name
  load_balancer_data['id']
end

#save(action_handler) ⇒ Object

Save this node to the server. If you have significant information that could be lost, you should do this as quickly as possible. Data will be saved automatically for you after allocate_machine and ready_machine.



82
83
84
# File 'lib/chef/provisioning/load_balancer_spec.rb', line 82

def save(action_handler)
  raise "save unimplemented"
end