From f55aca091c3d4061932caef29553affe21c6d7a5 Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Fri, 22 Nov 2019 13:50:41 -0800 Subject: [PATCH] Wrap disk feature in experimental flag --- plugins/kernel_v2/config/vm.rb | 5 +++++ test/unit/plugins/kernel_v2/config/vm_test.rb | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/plugins/kernel_v2/config/vm.rb b/plugins/kernel_v2/config/vm.rb index 7baaca319..7c0e4e423 100644 --- a/plugins/kernel_v2/config/vm.rb +++ b/plugins/kernel_v2/config/vm.rb @@ -433,6 +433,11 @@ module VagrantPlugins # Add provider config disk_config.add_provider_config(provider_options, &block) + if !Vagrant::Util::Experimental.feature_enabled?("disk_base_config") + @logger.warn("Disk config defined, but experimental feature is not enabled. To use this feature, enable it with the experimental flag `disk_base_config`. Disk will not be added to internal config, and will be ignored.") + return + end + @disks << disk_config end diff --git a/test/unit/plugins/kernel_v2/config/vm_test.rb b/test/unit/plugins/kernel_v2/config/vm_test.rb index 43cb2fcfc..20775ce75 100644 --- a/test/unit/plugins/kernel_v2/config/vm_test.rb +++ b/test/unit/plugins/kernel_v2/config/vm_test.rb @@ -550,6 +550,11 @@ describe VagrantPlugins::Kernel_V2::VMConfig do end describe "#disk" do + before(:each) do + allow(Vagrant::Util::Experimental).to receive(:feature_enabled?). + with("disk_base_config").and_return("true") + end + it "stores the disks" do subject.disk(:disk, size: 100) subject.disk(:disk, size: 1000, primary: false, name: "storage")