From 1770ad1ee5c45eb46c0d1d70e9ec8ffb3bbc48f6 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 17 Dec 2011 20:27:24 -0800 Subject: [PATCH] "provision.enabled" is once again honored. [GH-591] --- CHANGELOG.md | 1 + lib/vagrant/action/vm/provision.rb | 26 ++++++++++++++++++-------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04a2cc4a3..ee5321b4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ `sudo` installed Vagrant installations work. [GH-580] - Provisioner stdout/stderr is now color coded based on stdout/stderr. stdout is green, stderr is red. [GH-595] + - "--no-provision" once again works for certain commands. [GH-591] ## 0.8.10 (December 10, 2011) diff --git a/lib/vagrant/action/vm/provision.rb b/lib/vagrant/action/vm/provision.rb index 9cb1ba43b..a8cc44f6b 100644 --- a/lib/vagrant/action/vm/provision.rb +++ b/lib/vagrant/action/vm/provision.rb @@ -9,17 +9,27 @@ module Vagrant end def call(env) - # Instantiate and prepare the provisioners. Preparation must happen here - # so that shared folders and such can properly take effect. - provisioners = enabled_provisioners - provisioners.map { |p| p.prepare } + provisioners = nil + + # We set this here so that even if this value is changed in the future, + # it stays constant to what we expect here in this moment. + enabled = env["provision.enabled"] + if enabled + # Instantiate and prepare the provisioners. Preparation must happen here + # so that shared folders and such can properly take effect. + provisioners = enabled_provisioners + provisioners.map { |p| p.prepare } + end @app.call(env) - # Take prepared provisioners and run the provisioning - provisioners.each do |instance| - @env[:ui].info I18n.t("vagrant.actions.vm.provision.beginning", :provisioner => instance.class) - instance.provision! + if enabled + # Take prepared provisioners and run the provisioning + provisioners.each do |instance| + @env[:ui].info I18n.t("vagrant.actions.vm.provision.beginning", + :provisioner => instance.class) + instance.provision! + end end end