Merge pull request #5981 from jkburges/named_provision_with

Allow provisioner instance names to be specified for `up` and `reload…
This commit is contained in:
Mitchell Hashimoto 2015-11-18 10:54:22 -08:00
commit fdd3b5c7ec
3 changed files with 18 additions and 9 deletions

View File

@ -30,7 +30,7 @@ module VagrantPlugins
return if !argv return if !argv
# Validate the provisioners # Validate the provisioners
validate_provisioner_flags!(options) validate_provisioner_flags!(options, argv)
@logger.debug("'reload' each target VM...") @logger.debug("'reload' each target VM...")
machines = [] machines = []

View File

@ -55,7 +55,7 @@ module VagrantPlugins
return if !argv return if !argv
# Validate the provisioners # Validate the provisioners
validate_provisioner_flags!(options) validate_provisioner_flags!(options, argv)
# Go over each VM and bring it up # Go over each VM and bring it up
@logger.debug("'Up' each target VM...") @logger.debug("'Up' each target VM...")

View File

@ -26,7 +26,15 @@ module VagrantPlugins
# This validates the provisioner flags and raises an exception # This validates the provisioner flags and raises an exception
# if there are invalid ones. # if there are invalid ones.
def validate_provisioner_flags!(options) def validate_provisioner_flags!(options, argv)
provisioner_instance_names = []
with_target_vms(argv) do |machine|
provisioner_instance_names << machine.config.vm.provisioners.map(&:name)
end
provisioner_instance_names.flatten!.uniq!
if (provisioner_instance_names & options[:provision_types]).empty?
(options[:provision_types] || []).each do |type| (options[:provision_types] || []).each do |type|
klass = Vagrant.plugin("2").manager.provisioners[type] klass = Vagrant.plugin("2").manager.provisioners[type]
if !klass if !klass
@ -38,3 +46,4 @@ module VagrantPlugins
end end
end end
end end
end