`vagrant reload` accepts `--no-provision` and `--provision-with`
This commit is contained in:
parent
cd65eba3af
commit
8ea5e15b48
|
@ -12,6 +12,8 @@
|
|||
- Downloading boxes from servers that don't send a content-length
|
||||
now works properly. [GH-788]
|
||||
- The `:facter` option now works for puppet server. [GH-790]
|
||||
- The `--no-provision` and `--provision-with` flags are available to
|
||||
`vagrant reload` now.
|
||||
|
||||
## 1.0.0 (March 6, 2012)
|
||||
|
||||
|
|
|
@ -1,13 +1,18 @@
|
|||
require 'optparse'
|
||||
|
||||
require 'vagrant/command/start_mixins'
|
||||
|
||||
module Vagrant
|
||||
module Command
|
||||
class Reload < Base
|
||||
include StartMixins
|
||||
|
||||
def execute
|
||||
options = {}
|
||||
|
||||
opts = OptionParser.new do |opts|
|
||||
opts.banner = "Usage: vagrant reload [vm-name]"
|
||||
opts.separator ""
|
||||
build_start_options(opts, options)
|
||||
end
|
||||
|
||||
# Parse the options
|
||||
|
@ -18,7 +23,7 @@ module Vagrant
|
|||
with_target_vms(argv[0]) do |vm|
|
||||
if vm.created?
|
||||
@logger.info("Reloading: #{vm.name}")
|
||||
vm.reload
|
||||
vm.reload(options)
|
||||
else
|
||||
@logger.info("Not created: #{vm.name}. Not reloading.")
|
||||
vm.ui.info I18n.t("vagrant.commands.common.vm_not_created")
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
module Vagrant
|
||||
module Command
|
||||
module StartMixins
|
||||
# This adds the standard `start` command line flags to the given
|
||||
# OptionParser, storing the result in the `options` dictionary.
|
||||
#
|
||||
# @param [OptionParser] parser
|
||||
# @param [Hash] options
|
||||
def build_start_options(parser, options)
|
||||
# Setup the defaults
|
||||
options["provision.enabled"] = true
|
||||
options["provision.types"] = nil
|
||||
|
||||
# Add the options
|
||||
parser.on("--[no-]provision", "Enable or disable provisioning") do |p|
|
||||
options["provision.enabled"] = p
|
||||
end
|
||||
|
||||
parser.on("--provision-with x,y,z", Array,
|
||||
"Enable only certain provisioners, by type.") do |list|
|
||||
options["provision.types"] = list
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,49 +1,34 @@
|
|||
require 'optparse'
|
||||
|
||||
require 'vagrant/command/start_mixins'
|
||||
|
||||
module Vagrant
|
||||
module Command
|
||||
class Up < Base
|
||||
def execute
|
||||
options = {
|
||||
:provision => true,
|
||||
:provisioners => nil
|
||||
}
|
||||
include StartMixins
|
||||
|
||||
def execute
|
||||
options = {}
|
||||
opts = OptionParser.new do |opts|
|
||||
opts.banner = "Usage: vagrant up [vm-name] [--[no-]provision] [-h]"
|
||||
|
||||
opts.separator ""
|
||||
|
||||
opts.on("--[no-]provision", "Enable or disable provisioning") do |p|
|
||||
options[:provision] = p
|
||||
end
|
||||
|
||||
opts.on("--provision-with x,y,z", Array,
|
||||
"Enable only certain provisioners, by type.") do |list|
|
||||
options[:provisioners] = list
|
||||
end
|
||||
build_start_options(opts, options)
|
||||
end
|
||||
|
||||
# Parse the options
|
||||
argv = parse_options(opts)
|
||||
return if !argv
|
||||
|
||||
# Parameters to send to actions
|
||||
action_params = {
|
||||
"provision.enabled" => options[:provision],
|
||||
"provision.types" => options[:provisioners]
|
||||
}
|
||||
|
||||
# Go over each VM and bring it up
|
||||
@logger.debug("'Up' each target VM...")
|
||||
with_target_vms(argv[0]) do |vm|
|
||||
if vm.created?
|
||||
@logger.info("Booting: #{vm.name}")
|
||||
vm.ui.info I18n.t("vagrant.commands.up.vm_created")
|
||||
vm.start(action_params)
|
||||
vm.start(options)
|
||||
else
|
||||
@logger.info("Creating: #{vm.name}")
|
||||
vm.up(action_params)
|
||||
vm.up(options)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -156,8 +156,8 @@ module Vagrant
|
|||
run_action(:halt, options)
|
||||
end
|
||||
|
||||
def reload
|
||||
run_action(:reload)
|
||||
def reload(options=nil)
|
||||
run_action(:reload, options)
|
||||
end
|
||||
|
||||
def provision
|
||||
|
|
Loading…
Reference in New Issue