summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPete Higgins <pete@peterhiggins.org>2020-03-13 13:18:33 -0700
committerPete Higgins <pete@peterhiggins.org>2020-03-23 13:55:01 -0700
commit1f629d3a004e45dfd25d06a46f565d52ac192c18 (patch)
treeb03b4fc8f2783a680e14f2a9149f21cc20f8321f
parent55260569f085a39467c97a3a66e7d3b68ff6295b (diff)
downloadchef-1f629d3a004e45dfd25d06a46f565d52ac192c18.tar.gz
Default clear_sources to nil for chef_gem and gem_package.
Signed-off-by: Pete Higgins <pete@peterhiggins.org>
-rw-r--r--chef-config/lib/chef-config/config.rb2
-rw-r--r--lib/chef/resource/gem_package.rb2
-rw-r--r--spec/unit/resource/gem_package_spec.rb4
3 files changed, 4 insertions, 4 deletions
diff --git a/chef-config/lib/chef-config/config.rb b/chef-config/lib/chef-config/config.rb
index 1ee27949bc..0e89a9550c 100644
--- a/chef-config/lib/chef-config/config.rb
+++ b/chef-config/lib/chef-config/config.rb
@@ -1222,7 +1222,7 @@ module ChefConfig
default :rubygems_url, "https://www.rubygems.org"
# globally sets the default of the clear_sources property on the gem_package and chef_gem resources
- default :clear_gem_sources, false
+ default :clear_gem_sources, nil
# If installed via an omnibus installer, this gives the path to the
# "embedded" directory which contains all of the software packaged with
diff --git a/lib/chef/resource/gem_package.rb b/lib/chef/resource/gem_package.rb
index a8e16841dc..80eb257fa1 100644
--- a/lib/chef/resource/gem_package.rb
+++ b/lib/chef/resource/gem_package.rb
@@ -41,7 +41,7 @@ class Chef
property :source, [ String, Array ],
description: "Optional. The URL, or list of URLs, at which the gem package is located. This list is added to the source configured in Chef::Config[:rubygems_url] (see also include_default_source) to construct the complete list of rubygems sources. Users in an 'airgapped' environment should set Chef::Config[:rubygems_url] to their local RubyGems mirror."
- property :clear_sources, [ TrueClass, FalseClass ],
+ property :clear_sources, [ TrueClass, FalseClass, nil ],
description: "Set to 'true' to download a gem from the path specified by the source property (and not from RubyGems).",
default: lazy { Chef::Config[:clear_gem_sources] }, desired_state: false
diff --git a/spec/unit/resource/gem_package_spec.rb b/spec/unit/resource/gem_package_spec.rb
index aba6ab1032..949396abbc 100644
--- a/spec/unit/resource/gem_package_spec.rb
+++ b/spec/unit/resource/gem_package_spec.rb
@@ -56,8 +56,8 @@ end
describe Chef::Resource::GemPackage, "clear_gem_sources" do
let(:resource) { Chef::Resource::GemPackage.new("foo") }
- it "is false by default" do
- expect(resource.clear_sources).to be false
+ it "is nil by default" do
+ expect(resource.clear_sources).to be_nil
end
it "sets the default of clear_sources to the config value" do