summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2018-05-30 14:39:43 +0100
committerThom May <thom@chef.io>2018-05-30 14:39:43 +0100
commit22332c8d68aafe27eb230b3f59b535a1cc908423 (patch)
treef61c751708ab5f6980533b197f75f757bc4abc90
parent9640895af5514d291e417e298a4ed7e43653414e (diff)
downloadchef-22332c8d68aafe27eb230b3f59b535a1cc908423.tar.gz
return defaultstm/ri_defaults
Signed-off-by: Thom May <thom@chef.io>
-rw-r--r--lib/chef/resource_inspector.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/chef/resource_inspector.rb b/lib/chef/resource_inspector.rb
index f4c745c080..bbec03ffd6 100644
--- a/lib/chef/resource_inspector.rb
+++ b/lib/chef/resource_inspector.rb
@@ -24,6 +24,17 @@ require "chef/resources"
require "chef/json_compat"
module ResourceInspector
+ def self.get_default(default)
+ if default.kind_of?(Chef::DelayedEvaluator)
+ # ideally we'd get the block we pass to `lazy`, but the best we can do
+ # is to get the source location, which then results in reparsing the source
+ # code for the resource ourselves and just no
+ "lazy default"
+ else
+ default
+ end
+ end
+
def self.extract_resource(resource, complete = false)
data = {}
data[:description] = resource.description
@@ -44,6 +55,7 @@ module ResourceInspector
acc << { name: n, description: opts[:description],
introduced: opts[:introduced], is: opts[:is],
deprecated: opts[:deprecated] || false,
+ default: get_default(opts[:default]),
name_property: opts[:name_property] || false }
end
data