Merge pull request #3272 from pbitty/fix_provision_config
core: allow provisioner plugins to register without config
This commit is contained in:
commit
aaee1058e3
|
@ -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
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue