core: Don't provision after first `up` by default [GH-1776]
This commit is contained in:
parent
ab7cee1ae0
commit
e2ddab532d
|
@ -11,6 +11,9 @@ BACKWARDS INCOMPATIBILITY:
|
||||||
- The ':extra' flag to shared folders for specifying arbitrary mount
|
- The ':extra' flag to shared folders for specifying arbitrary mount
|
||||||
options has been replaced with the `:mount_options` flag, which is now
|
options has been replaced with the `:mount_options` flag, which is now
|
||||||
an array of mount options.
|
an array of mount options.
|
||||||
|
- `vagrant up` will now only run provisioning by default the first time
|
||||||
|
it is run. Subsequent `reload` or `up` will need to explicitly specify
|
||||||
|
the `--provision` flag to provision. [GH-1776]
|
||||||
|
|
||||||
FEATURES:
|
FEATURES:
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,8 @@ module Vagrant
|
||||||
include MixinProvisioners
|
include MixinProvisioners
|
||||||
|
|
||||||
def initialize(app, env)
|
def initialize(app, env)
|
||||||
@app = app
|
@app = app
|
||||||
@logger = Log4r::Logger.new("vagrant::action::builtin::provision")
|
@logger = Log4r::Logger.new("vagrant::action::builtin::provision")
|
||||||
end
|
end
|
||||||
|
|
||||||
def call(env)
|
def call(env)
|
||||||
|
@ -24,6 +24,25 @@ module Vagrant
|
||||||
|
|
||||||
# Check if we're even provisioning things.
|
# Check if we're even provisioning things.
|
||||||
enabled = true
|
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)
|
||||||
|
if !ignore_sentinel
|
||||||
|
@logger.info("Checking provisioner sentinel if we should run...")
|
||||||
|
sentinel = env[:machine].data_dir.join("action_provision")
|
||||||
|
if sentinel.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
|
||||||
|
|
||||||
|
# If we explicitly specified, take that value.
|
||||||
enabled = env[:provision_enabled] if env.has_key?(:provision_enabled)
|
enabled = env[:provision_enabled] if env.has_key?(:provision_enabled)
|
||||||
|
|
||||||
# Ask the provisioners to modify the configuration if needed
|
# Ask the provisioners to modify the configuration if needed
|
||||||
|
|
|
@ -13,6 +13,7 @@ module VagrantPlugins
|
||||||
options = {}
|
options = {}
|
||||||
options[:destroy_on_error] = true
|
options[:destroy_on_error] = true
|
||||||
options[:parallel] = true
|
options[:parallel] = true
|
||||||
|
options[:provision_ignore_sentinel] = false
|
||||||
|
|
||||||
opts = OptionParser.new do |o|
|
opts = OptionParser.new do |o|
|
||||||
o.banner = "Usage: vagrant up [vm-name] [options] [-h]"
|
o.banner = "Usage: vagrant up [vm-name] [options] [-h]"
|
||||||
|
|
|
@ -8,7 +8,6 @@ module VagrantPlugins
|
||||||
# @param [Hash] options
|
# @param [Hash] options
|
||||||
def build_start_options(parser, options)
|
def build_start_options(parser, options)
|
||||||
# Setup the defaults
|
# Setup the defaults
|
||||||
options[:provision_enabled] = true
|
|
||||||
options[:provision_types] = nil
|
options[:provision_types] = nil
|
||||||
|
|
||||||
# Add the options
|
# Add the options
|
||||||
|
|
Loading…
Reference in New Issue