Class: Vagrant::Provisioners::Base
- Inherits:
-
Object
- Object
- Vagrant::Provisioners::Base
- Includes:
- Util
- Defined in:
- lib/vagrant/provisioners/base.rb
Overview
The base class for a "provisioner." A provisioner is responsible for provisioning a Vagrant system. This has been abstracted out to provide support for multiple solutions such as Chef Solo, Chef Client, and Puppet.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#action_env ⇒ Object
readonly
The environment which provisioner is running in.
-
#config ⇒ Object
readonly
The configuration for this provisioner.
Class Method Summary collapse
-
.register(shortcut) ⇒ Object
Registers a provisioner with a given shortcut.
-
.registered ⇒ Object
Returns the provisioner associated with the given shortcut.
Instance Method Summary collapse
-
#env ⇒ Vagrant::Environment
Returns the actual Environment which this provisioner represents.
-
#initialize(env, config) ⇒ Base
constructor
A new instance of Base.
-
#prepare ⇒ Object
This is the method called to "prepare" the provisioner.
-
#provision! ⇒ Object
This is the method called to provision the system.
-
#vm ⇒ Vagrant::VM
Returns the VM which this provisioner is working on.
Constructor Details
#initialize(env, config) ⇒ Base
Returns a new instance of Base.
31 32 33 34 |
# File 'lib/vagrant/provisioners/base.rb', line 31 def initialize(env, config) @action_env = env @config = config end |
Instance Attribute Details
#action_env ⇒ Object (readonly)
The environment which provisioner is running in. This is a Action::Environment
12 13 14 |
# File 'lib/vagrant/provisioners/base.rb', line 12 def action_env @action_env end |
#config ⇒ Object (readonly)
The configuration for this provisioner. This will be an instance of
the Config
class which is part of the provisioner.
16 17 18 |
# File 'lib/vagrant/provisioners/base.rb', line 16 def config @config end |
Class Method Details
.register(shortcut) ⇒ Object
Registers a provisioner with a given shortcut. This allows that provisioner to be referenced with the shortcut.
22 23 24 |
# File 'lib/vagrant/provisioners/base.rb', line 22 def self.register(shortcut) registered[shortcut] = self end |
.registered ⇒ Object
Returns the provisioner associated with the given shortcut.
27 28 29 |
# File 'lib/vagrant/provisioners/base.rb', line 27 def self.registered @@registered ||= {} end |
Instance Method Details
#env ⇒ Vagrant::Environment
Returns the actual Environment which this provisioner represents.
40 41 42 |
# File 'lib/vagrant/provisioners/base.rb', line 40 def env action_env.env end |
#prepare ⇒ Object
This is the method called to "prepare" the provisioner. This is called before any actions are run by the action runner (see Actions::Runner). This can be used to setup shared folders, forward ports, etc. Whatever is necessary on a "meta" level.
55 |
# File 'lib/vagrant/provisioners/base.rb', line 55 def prepare; end |
#provision! ⇒ Object
This is the method called to provision the system. This method is expected to do whatever necessary to provision the system (create files, SSH, etc.)
60 |
# File 'lib/vagrant/provisioners/base.rb', line 60 def provision!; end |
#vm ⇒ Vagrant::VM
Returns the VM which this provisioner is working on.
47 48 49 |
# File 'lib/vagrant/provisioners/base.rb', line 47 def vm env.vm end |