summaryrefslogtreecommitdiff
path: root/chef-utils/lib/chef-utils
diff options
context:
space:
mode:
authorLamont Granquist <lamont@chef.io>2020-01-30 17:18:05 -0800
committerGitHub <noreply@github.com>2020-01-30 17:18:05 -0800
commit7f6bff82061068677af265e8f929f944c0020273 (patch)
treefe1ab20dd487e5e89518dec0961c944fdf7623eb /chef-utils/lib/chef-utils
parentaccc6160248f7adefcf646378e35bc2f4759ea73 (diff)
parent165641fef35a418832f4373503e51ce7a7ac7c3c (diff)
downloadchef-7f6bff82061068677af265e8f929f944c0020273.tar.gz
Add chef-sugar include_recipe? helper (#9306)
Add chef-sugar include_recipe? helper
Diffstat (limited to 'chef-utils/lib/chef-utils')
-rw-r--r--chef-utils/lib/chef-utils/dsl/introspection.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/chef-utils/lib/chef-utils/dsl/introspection.rb b/chef-utils/lib/chef-utils/dsl/introspection.rb
index 6fb06107d2..c5dcdc0c20 100644
--- a/chef-utils/lib/chef-utils/dsl/introspection.rb
+++ b/chef-utils/lib/chef-utils/dsl/introspection.rb
@@ -1,5 +1,5 @@
#
-# Copyright:: Copyright 2018-2019, Chef Software Inc.
+# Copyright:: Copyright 2018-2020, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -97,6 +97,17 @@ module ChefUtils
end
end
+ # Determine if the current node includes the given recipe name.
+ #
+ # @param [String] recipe_name
+ #
+ # @return [Boolean]
+ #
+ def includes_recipe?(recipe_name, node = __getnode)
+ node.recipe?(recipe_name)
+ end
+ alias_method :include_recipe?, :includes_recipe?
+
extend self
end
end