diff options
author | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-06-25 16:17:36 -0700 |
---|---|---|
committer | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-07-06 16:31:06 -0700 |
commit | b4584f6bfd50a2d862d0319f8511f6ff16c46bbb (patch) | |
tree | c88ef1ea493c1739a69845e4c63b88bd1f87f271 | |
parent | 5199f6b6e02a6d3a71a6c9cd1727f96c1060d4ee (diff) | |
download | chef-b4584f6bfd50a2d862d0319f8511f6ff16c46bbb.tar.gz |
Merge pull request #3599 from chef/jdm/3593
Fix issue where blocks were not considered in priority mapping
-rw-r--r-- | lib/chef/node_map.rb | 2 | ||||
-rw-r--r-- | spec/unit/node_map_spec.rb | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/chef/node_map.rb b/lib/chef/node_map.rb index d5eed7c215..edf0fd689a 100644 --- a/lib/chef/node_map.rb +++ b/lib/chef/node_map.rb @@ -181,7 +181,7 @@ class Chef end def compare_matchers(key, new_matcher, matcher) - cmp = compare_matcher_properties(new_matcher, matcher) { |m| m[:filters][:block] } + 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] } return cmp if cmp != 0 diff --git a/spec/unit/node_map_spec.rb b/spec/unit/node_map_spec.rb index 9b5ff5e8c6..7b37ea59f4 100644 --- a/spec/unit/node_map_spec.rb +++ b/spec/unit/node_map_spec.rb @@ -131,6 +131,18 @@ describe Chef::NodeMap do allow(node).to receive(:[]).with(:platform_version).and_return("6.0") expect(node_map.get(node, :thing)).to eql(nil) end + + context "when there is a less specific definition" do + before do + node_map.set(:thing, :bar, platform_family: "rhel") + end + + it "returns the value when the node matches" do + allow(node).to receive(:[]).with(:platform_family).and_return("rhel") + allow(node).to receive(:[]).with(:platform_version).and_return("7.0") + expect(node_map.get(node, :thing)).to eql(:foo) + end + end end describe "resource back-compat testing" do |