commands/up: use sets
This commit is contained in:
parent
d7f296175e
commit
b69d635f75
|
@ -1,3 +1,5 @@
|
||||||
|
require "set"
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandUp
|
module CommandUp
|
||||||
module StartMixins
|
module StartMixins
|
||||||
|
@ -27,14 +29,14 @@ 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, argv)
|
def validate_provisioner_flags!(options, argv)
|
||||||
provisioner_instance_names = []
|
provisioner_names = Set.new
|
||||||
with_target_vms(argv) do |machine|
|
with_target_vms(argv) do |machine|
|
||||||
provisioner_instance_names << machine.config.vm.provisioners.map(&:name)
|
machine.config.vm.provisioners.map(&:name).each do |name|
|
||||||
|
provisioner_names.add(name)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
provisioner_instance_names.flatten!.uniq!
|
if (provisioner_names & options[:provision_types]).empty?
|
||||||
|
|
||||||
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
|
||||||
|
|
Loading…
Reference in New Issue