summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2018-01-26 17:32:50 +0000
committerThom May <thom@chef.io>2018-01-26 17:32:50 +0000
commit70c547c96f7b84f16e70f4cd7a646e5a26649696 (patch)
treed951b6ac4151b937ff6925e28b7e43c050bf0943
parent1b58e044a3c2b3fb11f4064a092fb268203be269 (diff)
downloadchef-tm/true_nillable.tar.gz
Nillable properties are the default nowtm/true_nillable
Fixes: #6054 Signed-off-by: Thom May <thom@chef.io>
-rw-r--r--lib/chef/resource/apt_repository.rb10
-rw-r--r--spec/unit/resource/apt_repository_spec.rb5
2 files changed, 5 insertions, 10 deletions
diff --git a/lib/chef/resource/apt_repository.rb b/lib/chef/resource/apt_repository.rb
index 5da0b4e37b..5b81112cbe 100644
--- a/lib/chef/resource/apt_repository.rb
+++ b/lib/chef/resource/apt_repository.rb
@@ -30,17 +30,17 @@ class Chef
property :repo_name, String, name_property: true
property :uri, String
- property :distribution, [ String, nil, false ], default: lazy { node["lsb"]["codename"] }, nillable: true, coerce: proc { |x| x ? x : nil }
+ property :distribution, [ String, nil, false ], default: lazy { node["lsb"]["codename"] }, coerce: proc { |x| x ? x : nil }
property :components, Array, default: []
- property :arch, [String, nil, false], default: nil, nillable: true, coerce: proc { |x| x ? x : nil }
+ property :arch, [String, nil, false], default: nil, coerce: proc { |x| x ? x : nil }
property :trusted, [TrueClass, FalseClass], default: false
# whether or not to add the repository as a source repo, too
property :deb_src, [TrueClass, FalseClass], default: false
- property :keyserver, [String, nil, false], default: "keyserver.ubuntu.com", nillable: true, coerce: proc { |x| x ? x : nil }
+ property :keyserver, [String, nil, false], default: "keyserver.ubuntu.com", coerce: proc { |x| x ? x : nil }
property :key, [String, Array, nil, false], default: [], coerce: proc { |x| x ? Array(x) : nil }
- property :key_proxy, [String, nil, false], default: nil, nillable: true, coerce: proc { |x| x ? x : nil }
+ property :key_proxy, [String, nil, false], default: nil, coerce: proc { |x| x ? x : nil }
- property :cookbook, [String, nil, false], default: nil, desired_state: false, nillable: true, coerce: proc { |x| x ? x : nil }
+ property :cookbook, [String, nil, false], default: nil, desired_state: false, coerce: proc { |x| x ? x : nil }
property :cache_rebuild, [TrueClass, FalseClass], default: true, desired_state: false
default_action :add
diff --git a/spec/unit/resource/apt_repository_spec.rb b/spec/unit/resource/apt_repository_spec.rb
index 445df4a0d1..fecf3be582 100644
--- a/spec/unit/resource/apt_repository_spec.rb
+++ b/spec/unit/resource/apt_repository_spec.rb
@@ -28,11 +28,6 @@ describe Chef::Resource::AptRepository do
expect(resource.keyserver).to eql("keyserver.ubuntu.com")
end
- it "default distribution is nillable" do
- expect(resource.distribution(nil)).to eql(nil)
- expect(resource.distribution).to eql(nil)
- end
-
it "resolves to a Noop class when on non-linux OS" do
node.automatic[:os] = "windows"
node.automatic[:platform_family] = "windows"