Permalink
Browse files

core: Don't provision after first `up` by default [GH-1776]

  • Loading branch information...
1 parent ab7cee1 commit e2ddab532d575d786365c3870964a60692bdf1d7 @mitchellh mitchellh committed Sep 2, 2013
Showing with 25 additions and 3 deletions.
  1. +3 −0 CHANGELOG.md
  2. +21 −2 lib/vagrant/action/builtin/provision.rb
  3. +1 −0 plugins/commands/up/command.rb
  4. +0 −1 plugins/commands/up/start_mixins.rb
View
@@ -11,6 +11,9 @@ BACKWARDS INCOMPATIBILITY:
- The ':extra' flag to shared folders for specifying arbitrary mount
options has been replaced with the `:mount_options` flag, which is now
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:
@@ -15,15 +15,34 @@ class Provision
include MixinProvisioners
def initialize(app, env)
- @app = app
- @logger = Log4r::Logger.new("vagrant::action::builtin::provision")
+ @app = app
+ @logger = Log4r::Logger.new("vagrant::action::builtin::provision")
end
def call(env)
@env = env
# Check if we're even provisioning things.
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)
# Ask the provisioners to modify the configuration if needed
@@ -13,6 +13,7 @@ def execute
options = {}
options[:destroy_on_error] = true
options[:parallel] = true
+ options[:provision_ignore_sentinel] = false
opts = OptionParser.new do |o|
o.banner = "Usage: vagrant up [vm-name] [options] [-h]"
@@ -8,7 +8,6 @@ module StartMixins
# @param [Hash] options
def build_start_options(parser, options)
# Setup the defaults
- options[:provision_enabled] = true
options[:provision_types] = nil
# Add the options

0 comments on commit e2ddab5

Please sign in to comment.