diff --git a/CHANGELOG.md b/CHANGELOG.md index ee6e3b50e..445214605 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ FEATURES: - Add a VirtualBox provider config `auto_nat_dns_proxy` which when set to false will not attempt to automatically manage NAT DNS proxy settings with VirtualBox. [GH-1313] + - `vagrant provision` accepts the `--provision-with` flag [GH-1167] IMPROVEMENTS / BUG FIXES: diff --git a/plugins/commands/provision/command.rb b/plugins/commands/provision/command.rb index ba8d2800c..6d59dc4cc 100644 --- a/plugins/commands/provision/command.rb +++ b/plugins/commands/provision/command.rb @@ -4,8 +4,16 @@ module VagrantPlugins module CommandProvision class Command < Vagrant.plugin("2", :command) def execute + options = {} + options[:provision_types] = nil + opts = OptionParser.new do |o| - o.banner = "Usage: vagrant provision [vm-name]" + o.banner = "Usage: vagrant provision [vm-name] [--provision-with x,y,z]" + + o.on("--provision-with x,y,z", Array, + "Enable only certain provisioners, by type.") do |list| + options[:provision_types] = list.map { |type| type.to_sym } + end end # Parse the options @@ -15,7 +23,7 @@ module VagrantPlugins # Go over each VM and provision! @logger.debug("'provision' each target VM...") with_target_vms(argv) do |machine| - machine.action(:provision) + machine.action(:provision, options) end # Success, exit status 0