diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2018-01-22 18:45:28 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-22 18:45:28 -0800 |
commit | 3c1e14a40b4fb381f794c212151176537888fa53 (patch) | |
tree | 62f09b2c2807235915bbda320f4fb0841fcb45fa /lib/chef | |
parent | 9eb78fa2d0edb9366fc2bc34f9ec3954fda48261 (diff) | |
parent | d66b3ce039cc405c2af548b4aec10736e83f4805 (diff) | |
download | chef-3c1e14a40b4fb381f794c212151176537888fa53.tar.gz |
Merge pull request #6765 from chef/lcg/node-map-last-writer-wins
Convert node map to last-writer-wins for ties
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/node_map.rb | 28 | ||||
-rw-r--r-- | lib/chef/resource/file.rb | 2 | ||||
-rw-r--r-- | lib/chef/resource/link.rb | 3 |
3 files changed, 8 insertions, 25 deletions
diff --git a/lib/chef/node_map.rb b/lib/chef/node_map.rb index dde93a437d..ecd5c9df8f 100644 --- a/lib/chef/node_map.rb +++ b/lib/chef/node_map.rb @@ -1,6 +1,6 @@ # # Author:: Lamont Granquist (<lamont@chef.io>) -# Copyright:: Copyright 2014-2017, Chef Software Inc. +# Copyright:: Copyright 2014-2018, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -192,8 +192,10 @@ class Chef !!canonical == !!matcher[:canonical] end - # @api private - def dispatch_compare_matchers(key, new_matcher, matcher) + # + # "provides" lines with identical filters sort by class name (ascending). + # + def compare_matchers(key, new_matcher, matcher) cmp = compare_matcher_properties(new_matcher[:block], matcher[:block]) return cmp if cmp != 0 cmp = compare_matcher_properties(new_matcher[:platform_version], matcher[:platform_version]) @@ -210,26 +212,6 @@ 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 - # XXX: remove this in Chef-14 and use last-writer-wins (prepend if they match) - if !new_matcher[:override] - # we only sort classes, which only sorts the handler array, this magically does not sort - # the priority array via the invisible else here. - if new_matcher[:klass].is_a?(Class) - cmp = compare_matcher_properties(new_matcher[:klass].name, matcher[:klass].name) - end - end - end - cmp - end - def compare_matcher_properties(a, b) # falsity comparisons here handle both "nil" and "false" return 1 if !a && b diff --git a/lib/chef/resource/file.rb b/lib/chef/resource/file.rb index 43d9c57150..787992fc24 100644 --- a/lib/chef/resource/file.rb +++ b/lib/chef/resource/file.rb @@ -1,7 +1,7 @@ # # Author:: Adam Jacob (<adam@chef.io>) # Author:: Seth Chisamore (<schisamo@chef.io>) -# Copyright:: Copyright 2008-2016 Chef Software, Inc. +# Copyright:: Copyright 2008-2018, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/lib/chef/resource/link.rb b/lib/chef/resource/link.rb index 7a106b1703..d51d42b506 100644 --- a/lib/chef/resource/link.rb +++ b/lib/chef/resource/link.rb @@ -1,7 +1,7 @@ # # Author:: Adam Jacob (<adam@chef.io>) # Author:: Tyler Cloke (<tyler@chef.io>) -# Copyright:: Copyright 2008-2016, Chef Software Inc. +# Copyright:: Copyright 2008-2018, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -34,6 +34,7 @@ class Chef # original file. class Link < Chef::Resource include Chef::Mixin::Securable + resource_name :link identity_attr :target_file |