From cf1d94b22b9fa18410258a9728e9a75ffa769665 Mon Sep 17 00:00:00 2001 From: Teemu Matilainen Date: Sat, 7 Dec 2013 17:09:04 -0300 Subject: [PATCH] core: Print info message if provisioning is skipped by the sentinel file Tell the user if the VM has already been provisioned and no `--[no-]provision` option has been specified. This should reduce the confusion of the 1.3+ functionality. --- lib/vagrant/action/builtin/provision.rb | 16 ++++++---------- templates/locales/en.yml | 1 + 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/vagrant/action/builtin/provision.rb b/lib/vagrant/action/builtin/provision.rb index bc92b8dd5..32f7f9d80 100644 --- a/lib/vagrant/action/builtin/provision.rb +++ b/lib/vagrant/action/builtin/provision.rb @@ -22,10 +22,9 @@ module Vagrant def call(env) @env = env - # Check if we're even provisioning things. + # Check if we already provisioned, and if so, disable the rest enabled = true - # Check if we already provisioned, and if so, disable the rest ignore_sentinel = true ignore_sentinel = env[:provision_ignore_sentinel] if env.has_key?(:provision_ignore_sentinel) sentinel_path = nil @@ -39,13 +38,8 @@ module Vagrant end end - if env.has_key?(:provision_enabled) - # If we explicitly specified, take that value. - enabled = env[:provision_enabled] - else - # Otherwise store the value so that other actions can use it. - env[:provision_enabled] = enabled - end + # Store the value so that other actions can use it + env[:provision_enabled] = enabled if !env.has_key?(:provision_enabled) # Ask the provisioners to modify the configuration if needed provisioner_instances(env).each do |p| @@ -64,7 +58,7 @@ module Vagrant end # Actually provision if we enabled it - if enabled + if env[:provision_enabled] type_map = provisioner_type_map(env) provisioner_instances(env).each do |p| type_name = type_map[p] @@ -81,6 +75,8 @@ module Vagrant provisioner_name: type_name, )) end + elsif !enabled + env[:ui].info(I18n.t("vagrant.actions.vm.provision.disabled_by_sentinel")) end end diff --git a/templates/locales/en.yml b/templates/locales/en.yml index d3cbd88c8..042256683 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -1138,6 +1138,7 @@ en: persisting: "Persisting the VM UUID (%{uuid})..." provision: beginning: "Running provisioner: %{provisioner}..." + disabled_by_sentinel: "VM already provisioned. Run `vagrant provision` or use `--provision` to force it" resume: resuming: Resuming suspended VM... unpausing: |-