diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-07-23 13:26:24 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-07-23 13:26:24 -0700 |
commit | e86b53c4d4b27be58a18f7bf98312251c42953a4 (patch) | |
tree | 9b5582cb2fb103fdb32733314bb7b0cb7c019992 | |
parent | 48db22f355b5f54f7227da81add48dd79def4ab7 (diff) | |
download | chef-e86b53c4d4b27be58a18f7bf98312251c42953a4.tar.gz |
Fix chef-resource-inspector to handle classes in equal_to
Rescue argumenterrors and just return the array unsorted.
I'd flip the inspect and sort, but that would result in incorrectly
sorted data.
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | lib/chef/resource_inspector.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/chef/resource_inspector.rb b/lib/chef/resource_inspector.rb index a12b06fcb2..53c0fbd913 100644 --- a/lib/chef/resource_inspector.rb +++ b/lib/chef/resource_inspector.rb @@ -59,11 +59,17 @@ module ResourceInspector required: opts[:required] || false, default: opts[:default_description] || get_default(opts[:default]), name_property: opts[:name_property] || false, - equal_to: Array(opts[:equal_to]).sort.map(&:inspect) } + equal_to: sort_equal_to(opts[:equal_to]) } end data end + def self.sort_equal_to(equal_to) + Array(equal_to).sort.map(&:inspect) + rescue ArgumentError + Array(equal_to).map(&:inspect) + end + def self.extract_cookbook(path, complete) path = File.expand_path(path) dir, name = File.split(path) |