summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-04-27 16:49:27 -0700
committerGitHub <noreply@github.com>2018-04-27 16:49:27 -0700
commit469c96e4527523ed5a4bc20c7a5bd090d3473b91 (patch)
tree7d02c1368c323cdaa5bf7ad222541643be40b645
parent2651a43b251f209a63ebc814330271ec5f1735b2 (diff)
parent6a012bd225aa24d14cca9ee70010a663cf733682 (diff)
downloadchef-469c96e4527523ed5a4bc20c7a5bd090d3473b91.tar.gz
Merge pull request #7197 from chef/build_name
Allow build_essential resource to be used without setting a name
-rw-r--r--kitchen-tests/cookbooks/base/recipes/default.rb2
-rw-r--r--lib/chef/resource/build_essential.rb3
-rw-r--r--spec/unit/resource/build_essential_spec.rb8
3 files changed, 12 insertions, 1 deletions
diff --git a/kitchen-tests/cookbooks/base/recipes/default.rb b/kitchen-tests/cookbooks/base/recipes/default.rb
index dac989cc81..ea0215ca96 100644
--- a/kitchen-tests/cookbooks/base/recipes/default.rb
+++ b/kitchen-tests/cookbooks/base/recipes/default.rb
@@ -25,7 +25,7 @@ yum_repository "epel" do
only_if { platform_family?("rhel") }
end
-build_essential "install compilation tools"
+build_essential
include_recipe "::packages"
diff --git a/lib/chef/resource/build_essential.rb b/lib/chef/resource/build_essential.rb
index 8d32af9684..155de864f9 100644
--- a/lib/chef/resource/build_essential.rb
+++ b/lib/chef/resource/build_essential.rb
@@ -25,6 +25,9 @@ class Chef
description "Use the build_essential resource to install packages required for compiling C software from source"
introduced "14.0"
+ # this allows us to use build_essential without setting a name
+ property :name, String, default: ""
+
property :compile_time, [TrueClass, FalseClass],
description: "Install build essential packages at compile time.",
default: false
diff --git a/spec/unit/resource/build_essential_spec.rb b/spec/unit/resource/build_essential_spec.rb
index dff94e6bdc..5c25d3e961 100644
--- a/spec/unit/resource/build_essential_spec.rb
+++ b/spec/unit/resource/build_essential_spec.rb
@@ -28,4 +28,12 @@ describe Chef::Resource::BuildEssential do
it "has a default action of install" do
expect(resource.action).to eql([:install])
end
+
+ context "when not settting a resource name" do
+ let(:resource) { Chef::Resource::BuildEssential.new(nil) }
+
+ it "the name defaults to an empty string" do
+ expect(resource.name).to eql("")
+ end
+ end
end