core: create sentinel just before provisioning [GH-2488]

This commit is contained in:
Mitchell Hashimoto 2013-11-25 11:52:48 -08:00
parent 3219be3d51
commit 5f1cf5872f
2 changed files with 13 additions and 7 deletions

View File

@ -53,6 +53,7 @@ BUG FIXES:
- core: Don't load Vagrantfile on `vagrant plugin` commands, allowing
Vagrantfiles that use plugins to work. [GH-2388]
- core: global flags are ignored past the "--" on the CLI. [GH-2491]
- core: provisoining will properly happen if `up` failed. [GH-2488]
- guests/freebsd: Mounting NFS folders works. [GH-2400]
- guests/freebsd: Uses `sh` by default for shell. [GH-2485]
- guests/redhat: Down interface before messing up configuration file

View File

@ -28,17 +28,14 @@ module Vagrant
# 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
if !ignore_sentinel
@logger.info("Checking provisioner sentinel if we should run...")
sentinel = env[:machine].data_dir.join("action_provision")
if sentinel.file?
sentinel_path = env[:machine].data_dir.join("action_provision")
if sentinel_path.file?
@logger.info("Sentinel found! Not provisioning.")
enabled = false
else
@logger.info("Sentinel not found.")
sentinel.open("w") do |f|
f.write(Time.now.to_i.to_s)
end
end
end
@ -58,6 +55,14 @@ module Vagrant
# Continue, we need the VM to be booted.
@app.call(env)
# Write the sentinel if we have to
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)
end
end
# Actually provision if we enabled it
if enabled
type_map = provisioner_type_map(env)