Class: Vagrant::Actions::VM::Provision
- Defined in:
- lib/vagrant/actions/vm/provision.rb
Instance Attribute Summary collapse
-
#provisioner ⇒ Object
readonly
Returns the value of attribute provisioner.
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#cleanup, #follows, #initialize, #precedes, #rescue
Methods included from Util
#error_and_exit, included, #logger, #wrap_output
Constructor Details
This class inherits a constructor from Vagrant::Actions::Base
Instance Attribute Details
#provisioner ⇒ Object (readonly)
Returns the value of attribute provisioner.
5 6 7 |
# File 'lib/vagrant/actions/vm/provision.rb', line 5 def provisioner @provisioner end |
Instance Method Details
#execute! ⇒ Object
40 41 42 43 44 45 |
# File 'lib/vagrant/actions/vm/provision.rb', line 40 def execute! if provisioner logger.info "Beginning provisioning process..." provisioner.provision! end end |
#intialize(*args) ⇒ Object
7 8 9 10 11 |
# File 'lib/vagrant/actions/vm/provision.rb', line 7 def intialize(*args) super @provisioner = nil end |
#prepare ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/vagrant/actions/vm/provision.rb', line 13 def prepare provisioner = Vagrant.config.vm.provisioner if provisioner.nil? logger.info("Provisioning not enabled, ignoring this step") return end if provisioner.is_a?(Class) @provisioner = provisioner.new(@runner.env) raise ActionException.new(:provisioner_invalid_class) unless @provisioner.is_a?(Provisioners::Base) elsif provisioner.is_a?(Symbol) # We have a few hard coded provisioners for built-ins mapping = { :chef_solo => Provisioners::ChefSolo, :chef_server => Provisioners::ChefServer } provisioner_klass = mapping[provisioner] raise ActionException.new(:provisioner_unknown_type, :provisioner => provisioner.to_s) if provisioner_klass.nil? @provisioner = provisioner_klass.new(@runner.env) end logger.info "Provisioning enabled with #{@provisioner.class}" @provisioner.prepare end |