From 9e7f705bad44023777ad58d397f258fc63c4870b Mon Sep 17 00:00:00 2001 From: Torben Knerr Date: Tue, 16 Dec 2014 22:40:19 +0100 Subject: [PATCH] extend the Chef provisioner base config object with an 'installer_download_path' property --- plugins/provisioners/chef/config/base.rb | 10 ++++++++++ .../unit/plugins/provisioners/chef/config/base_test.rb | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/plugins/provisioners/chef/config/base.rb b/plugins/provisioners/chef/config/base.rb index 37124ad3f..4adb0d148 100644 --- a/plugins/provisioners/chef/config/base.rb +++ b/plugins/provisioners/chef/config/base.rb @@ -48,6 +48,14 @@ module VagrantPlugins # @return [String] attr_accessor :version + # The path where the Chef installer will be downloaded to. Only valid if + # install is true or "force". It defaults to nil, which means that the + # omnibus installer will choose the destination and you have no control + # over it. + # + # @return [String] + attr_accessor :installer_download_path + def initialize super @@ -57,6 +65,7 @@ module VagrantPlugins @log_level = UNSET_VALUE @prerelease = UNSET_VALUE @version = UNSET_VALUE + @installer_download_path = UNSET_VALUE end def finalize! @@ -66,6 +75,7 @@ module VagrantPlugins @log_level = :info if @log_level == UNSET_VALUE @prerelease = false if @prerelease == UNSET_VALUE @version = :latest if @version == UNSET_VALUE + @installer_download_path = nil if @installer_download_path == UNSET_VALUE # Make sure the install is a symbol if it's not a boolean if @install.respond_to?(:to_sym) diff --git a/test/unit/plugins/provisioners/chef/config/base_test.rb b/test/unit/plugins/provisioners/chef/config/base_test.rb index 2355f28cd..4b018f11b 100644 --- a/test/unit/plugins/provisioners/chef/config/base_test.rb +++ b/test/unit/plugins/provisioners/chef/config/base_test.rb @@ -68,4 +68,11 @@ describe VagrantPlugins::Chef::Config::Base do expect(subject.version).to eq(:latest) end end + + describe "#installer_download_path" do + it "defaults to nil" do + subject.finalize! + expect(subject.installer_download_path).to be(nil) + end + end end