Class: ChefMetal::Provisioner

Inherits:
Object
  • Object
show all
Defined in:
lib/chef_metal/driver.rb,
lib/chef_metal/provisioner.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.inflate(node) ⇒ Object

Inflate a provisioner from node information; we don’t want to force the driver to figure out what the provisioner really needs, since it varies from provisioner to provisioner.

## Parameters node - node to inflate the provisioner for

returns a should return a Privisoner from the information provided



11
12
13
# File 'lib/chef_metal/driver.rb', line 11

def self.inflate(node)
  raise "#{self.class} does not override self.inflate"
end

Instance Method Details

#acquire_machine(action_handler, node) ⇒ Object

Acquire a machine, generally by provisioning it. Returns a Machine object pointing at the machine, allowing useful actions like setup, converge, execute, file and directory. The Machine object will have a “node” property which must be saved to the server (if it is any different from the original node object).

## Parameters action_handler - the action_handler object that is calling this method; this

is generally a provider, but could be anything that can support the
interface (i.e., in the case of the test kitchen metal driver for
acquiring and destroying VMs).

node - node object (deserialized json) representing this machine. If

the node has a provisioner_options hash in it, these will be used
instead of options provided by the provisioner.  TODO compare and
fail if different?
node will have node['normal']['provisioner_options'] in it with any
options. It is a hash with at least these options:

   -- provisioner_url: <provisioner url>

node['normal']['provisioner_output'] will be populated with
information about the created machine.  For vagrant, it is a hash
with at least these options:

   -- provisioner_url: <provisioner url>


41
42
43
# File 'lib/chef_metal/driver.rb', line 41

def acquire_machine(action_handler, node)
  raise "#{self.class} does not override acquire_machine"
end

#connect_to_machine(node) ⇒ Object

Connect to a machine without acquiring it. This method will NOT make any changes to anything.

## Parameters node - node object (deserialized json) representing this machine. The

node may have normal attributes "provisioner_options" and
"provisioner_output" in it, representing the input and output of
any prior "acquire_machine" process (if any).


54
55
56
# File 'lib/chef_metal/driver.rb', line 54

def connect_to_machine(node)
  raise "#{self.class} does not override connect_to_machine"
end

#delete_machine(action_handler, node) ⇒ Object

Delete the given machine (idempotent). Should destroy the machine, returning things to the state before acquire_machine was called.



60
61
62
# File 'lib/chef_metal/driver.rb', line 60

def delete_machine(action_handler, node)
  raise "#{self.class} does not override delete_machine"
end

#resource_created(machine) ⇒ Object

Provider notification that happens at the point a resource is declared (after all properties have been set on it)



71
72
# File 'lib/chef_metal/driver.rb', line 71

def resource_created(machine)
end

#stop_machine(action_handler, node) ⇒ Object

Stop the given machine.



65
66
67
# File 'lib/chef_metal/driver.rb', line 65

def stop_machine(action_handler, node)
  raise "#{self.class} does not override stop_machine"
end