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.
This commit is contained in:
Teemu Matilainen 2013-12-07 17:09:04 -03:00
parent 5bf07d858e
commit cf1d94b22b
2 changed files with 7 additions and 10 deletions

View File

@ -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

View File

@ -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: |-