From 1f694d497811cbd8721e54745f08a02648882932 Mon Sep 17 00:00:00 2001 From: Paulo Bittencourt Date: Tue, 18 Mar 2014 14:36:40 -0400 Subject: [PATCH] kernel/v2: allow provisioner plugins to register without config --- plugins/kernel_v2/config/vm_provisioner.rb | 1 + test/unit/plugins/kernel_v2/config/vm_test.rb | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/plugins/kernel_v2/config/vm_provisioner.rb b/plugins/kernel_v2/config/vm_provisioner.rb index 912106137..63718e475 100644 --- a/plugins/kernel_v2/config/vm_provisioner.rb +++ b/plugins/kernel_v2/config/vm_provisioner.rb @@ -49,6 +49,7 @@ module VagrantPlugins if !@config_class @logger.info( "Provisioner config for '#{@name}' not found. Ignoring config.") + @config_class = Vagrant::Config::V2::DummyConfig end end diff --git a/test/unit/plugins/kernel_v2/config/vm_test.rb b/test/unit/plugins/kernel_v2/config/vm_test.rb index 690e8eb82..a295d512e 100644 --- a/test/unit/plugins/kernel_v2/config/vm_test.rb +++ b/test/unit/plugins/kernel_v2/config/vm_test.rb @@ -3,6 +3,8 @@ require File.expand_path("../../../../base", __FILE__) require Vagrant.source_root.join("plugins/kernel_v2/config/vm") describe VagrantPlugins::Kernel_V2::VMConfig do + include_context "unit" + subject { described_class.new } let(:machine) { double("machine") } @@ -210,6 +212,24 @@ describe VagrantPlugins::Kernel_V2::VMConfig do expect(r[0]).to be_invalid end + it "allows provisioners that don't define any config" do + register_plugin("2") do |p| + p.name "foo" + # This plugin registers a dummy provisioner + # without registering a provisioner config + p.provisioner(:foo) do + Class.new Vagrant::plugin("2", :provisioner) + end + end + + subject.provision("foo") do |c| + c.bar = "baz" + end + + # This should succeed without errors + expect{ subject.finalize! }.to_not raise_error + end + describe "merging" do it "copies the configs" do subject.provision("shell", inline: "foo")