Class: Vagrant::Plugin::V2::Provisioner

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant/plugin/v2/provisioner.rb

Overview

This is the base class for a provisioner for the V2 API. A provisioner is primarily responsible for installing software on a Vagrant guest.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(machine, config) ⇒ Provisioner

Initializes the provisioner with the machine that it will be provisioning along with the provisioner configuration (if there is any).

The provisioner should not do anything at this point except initialize internal state.

Parameters:

  • machine (Machine)

    The machine that this will be provisioning.

  • config (Object)

    Provisioner configuration, if one was set.


19
20
21
22
# File 'lib/vagrant/plugin/v2/provisioner.rb', line 19

def initialize(machine, config)
  @machine = machine
  @config  = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.


8
9
10
# File 'lib/vagrant/plugin/v2/provisioner.rb', line 8

def config
  @config
end

#machineObject (readonly)

Returns the value of attribute machine.


7
8
9
# File 'lib/vagrant/plugin/v2/provisioner.rb', line 7

def machine
  @machine
end

Instance Method Details

#cleanupObject

This is the method called when destroying a machine that allows for any state related to the machine created by the provisioner to be cleaned up.


48
49
# File 'lib/vagrant/plugin/v2/provisioner.rb', line 48

def cleanup
end

#configure(root_config) ⇒ Object

Called with the root configuration of the machine so the provisioner can add some configuration on top of the machine.

During this step, and this step only, the provisioner should modify the root machine configuration to add any additional features it may need. Examples include sharing folders, networking, and so on. This step is guaranteed to be called before any of those steps are done so the provisioner may do that.

No return value is expected.


34
35
# File 'lib/vagrant/plugin/v2/provisioner.rb', line 34

def configure(root_config)
end

#provisionObject

This is the method called when the actual provisioning should be done. The communicator is guaranteed to be ready at this point, and any shared folders or networks are already setup.

No return value is expected.


42
43
# File 'lib/vagrant/plugin/v2/provisioner.rb', line 42

def provision
end