diff --git a/CHANGELOG.md b/CHANGELOG.md index a79eab06e..fd6407344 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -69,6 +69,8 @@ BUG FIXES: be deleted. [GH-2873] - core: Static IPs can end in ".1". A warning is now shown. [GH-2914] - core: Adding boxes that have directories in them works on Windows. + - core: Vagrant will not think provisioning is already done if + the VM is manually deleted outside of Vagrant. - commands/box: Box add `--force` works with `--provider` flag. [GH-2757] - commands/box: Listing boxes with machine-readable output crash is gone. - commands/plugin: Plugin installation will fail if dependencies conflict, diff --git a/lib/vagrant/action/builtin/provision.rb b/lib/vagrant/action/builtin/provision.rb index f9732b84b..957066590 100644 --- a/lib/vagrant/action/builtin/provision.rb +++ b/lib/vagrant/action/builtin/provision.rb @@ -35,8 +35,13 @@ module Vagrant @logger.info("Checking provisioner sentinel if we should run...") sentinel_path = env[:machine].data_dir.join("action_provision") if sentinel_path.file? - @logger.info("Sentinel found! Not provisioning.") - enabled = false + if sentinel_path.read.chomp == env[:machine].id.to_s + @logger.info("Sentinel found! Not provisioning.") + enabled = false + else + @logger.info("Sentinel found with another machine ID. Removing.") + sentinel_path.unlink + end end end @@ -55,7 +60,7 @@ module Vagrant if sentinel_path && !sentinel_path.file? @logger.info("Writing provisioning sentinel so we don't provision again") sentinel_path.open("w") do |f| - f.write(Time.now.to_i.to_s) + f.write(env[:machine].id.to_s) end end