diff options
| author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-12-08 13:44:57 -0800 |
|---|---|---|
| committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-12-08 13:44:57 -0800 |
| commit | 5fbdf841ec3e4abce1e8dd05f46bddeb00492887 (patch) | |
| tree | bf9e303f929dbcd853d051c5b999178c3664395d /lib/chef/node_map.rb | |
| parent | e2c5935b818c8d1a74e24ba624de1ae489909fdb (diff) | |
| download | chef-5fbdf841ec3e4abce1e8dd05f46bddeb00492887.tar.gz | |
remove Chef::Platform::HandlerMaplcg/remove-chef-platform-handler-class
seems like an entirely unnecessary level of indirection
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/node_map.rb')
| -rw-r--r-- | lib/chef/node_map.rb | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/chef/node_map.rb b/lib/chef/node_map.rb index 9e64ccadc0..552c90b8d1 100644 --- a/lib/chef/node_map.rb +++ b/lib/chef/node_map.rb @@ -113,7 +113,7 @@ class Chef remaining end - protected + private # # Succeeds if: @@ -172,7 +172,8 @@ class Chef !!canonical == !!matcher[:canonical] end - def compare_matchers(key, new_matcher, matcher) + # @api private + def dispatch_compare_matchers(key, new_matcher, matcher) cmp = compare_matcher_properties(new_matcher, matcher) { |m| m[:block] } return cmp if cmp != 0 cmp = compare_matcher_properties(new_matcher, matcher) { |m| m[:filters][:platform_version] } @@ -189,6 +190,21 @@ class Chef 0 end + # + # "provides" lines with identical filters sort by class name (ascending). + # + def compare_matchers(key, new_matcher, matcher) + cmp = dispatch_compare_matchers(key, new_matcher, matcher) + if cmp == 0 + # Sort by class name (ascending) as well, if all other properties + # are exactly equal + if new_matcher[:value].is_a?(Class) && !new_matcher[:override] + cmp = compare_matcher_properties(new_matcher, matcher) { |m| m[:value].name } + end + end + cmp + end + def compare_matcher_properties(new_matcher, matcher) a = yield(new_matcher) b = yield(matcher) |
