--provision-with works properly again
This commit is contained in:
parent
e0f0066c99
commit
75ea4e5bdd
|
@ -20,10 +20,20 @@ module Vagrant
|
||||||
enabled = true
|
enabled = true
|
||||||
enabled = env[:provision_enabled] if env.has_key?(:provision_enabled)
|
enabled = env[:provision_enabled] if env.has_key?(:provision_enabled)
|
||||||
|
|
||||||
|
# This keeps track of a mapping between provisioner and type
|
||||||
|
type_map = {}
|
||||||
|
|
||||||
# Get all the configured provisioners
|
# Get all the configured provisioners
|
||||||
provisioners = env[:machine].config.vm.provisioners.map do |provisioner|
|
provisioners = env[:machine].config.vm.provisioners.map do |provisioner|
|
||||||
klass = Vagrant.plugin("2").manager.provisioners[provisioner.name]
|
# Instantiate the provisioner
|
||||||
klass.new(env[:machine], provisioner.config)
|
klass = Vagrant.plugin("2").manager.provisioners[provisioner.name]
|
||||||
|
result = klass.new(env[:machine], provisioner.config)
|
||||||
|
|
||||||
|
# Store in the type map so that --provision-with works properly
|
||||||
|
type_map[result] = provisioner.name
|
||||||
|
|
||||||
|
# Return the result
|
||||||
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
# Ask the provisioners to modify the configuration if needed
|
# Ask the provisioners to modify the configuration if needed
|
||||||
|
@ -37,6 +47,9 @@ module Vagrant
|
||||||
# Actually provision if we enabled it
|
# Actually provision if we enabled it
|
||||||
if enabled
|
if enabled
|
||||||
provisioners.each do |p|
|
provisioners.each do |p|
|
||||||
|
next if env[:provision_types] && \
|
||||||
|
!env[:provision_types].include?(type_map[p])
|
||||||
|
|
||||||
env[:ui].info(I18n.t("vagrant.actions.vm.provision.beginning",
|
env[:ui].info(I18n.t("vagrant.actions.vm.provision.beginning",
|
||||||
:provisioner => p.class))
|
:provisioner => p.class))
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ module VagrantPlugins
|
||||||
def build_start_options(parser, options)
|
def build_start_options(parser, options)
|
||||||
# Setup the defaults
|
# Setup the defaults
|
||||||
options[:provision_enabled] = true
|
options[:provision_enabled] = true
|
||||||
options["provision.types"] = nil
|
options[:provision_types] = nil
|
||||||
|
|
||||||
# Add the options
|
# Add the options
|
||||||
parser.on("--[no-]provision", "Enable or disable provisioning") do |p|
|
parser.on("--[no-]provision", "Enable or disable provisioning") do |p|
|
||||||
|
@ -18,7 +18,7 @@ module VagrantPlugins
|
||||||
|
|
||||||
parser.on("--provision-with x,y,z", Array,
|
parser.on("--provision-with x,y,z", Array,
|
||||||
"Enable only certain provisioners, by type.") do |list|
|
"Enable only certain provisioners, by type.") do |list|
|
||||||
options["provision.types"] = list
|
options[:provision_types] = list
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue