core: provisioner sentinel should check machine ID

This commit is contained in:
Mitchell Hashimoto 2014-02-23 21:23:31 -08:00
parent 2aa3a8bcde
commit 399a3e48da
2 changed files with 10 additions and 3 deletions

View File

@ -69,6 +69,8 @@ BUG FIXES:
be deleted. [GH-2873] be deleted. [GH-2873]
- core: Static IPs can end in ".1". A warning is now shown. [GH-2914] - 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: 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: Box add `--force` works with `--provider` flag. [GH-2757]
- commands/box: Listing boxes with machine-readable output crash is gone. - commands/box: Listing boxes with machine-readable output crash is gone.
- commands/plugin: Plugin installation will fail if dependencies conflict, - commands/plugin: Plugin installation will fail if dependencies conflict,

View File

@ -35,8 +35,13 @@ module Vagrant
@logger.info("Checking provisioner sentinel if we should run...") @logger.info("Checking provisioner sentinel if we should run...")
sentinel_path = env[:machine].data_dir.join("action_provision") sentinel_path = env[:machine].data_dir.join("action_provision")
if sentinel_path.file? if sentinel_path.file?
@logger.info("Sentinel found! Not provisioning.") if sentinel_path.read.chomp == env[:machine].id.to_s
enabled = false @logger.info("Sentinel found! Not provisioning.")
enabled = false
else
@logger.info("Sentinel found with another machine ID. Removing.")
sentinel_path.unlink
end
end end
end end
@ -55,7 +60,7 @@ module Vagrant
if sentinel_path && !sentinel_path.file? if sentinel_path && !sentinel_path.file?
@logger.info("Writing provisioning sentinel so we don't provision again") @logger.info("Writing provisioning sentinel so we don't provision again")
sentinel_path.open("w") do |f| sentinel_path.open("w") do |f|
f.write(Time.now.to_i.to_s) f.write(env[:machine].id.to_s)
end end
end end