diff options
author | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-06-25 16:17:36 -0700 |
---|---|---|
committer | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-06-25 16:17:36 -0700 |
commit | bba2a093aa7c0cda097650ce2f390ef63e648e52 (patch) | |
tree | 7357819336469052aca92ef94c16c8fcc0b5e599 | |
parent | cf3bbb0dcd78dde44394cf0dda70d7ceef097b9b (diff) | |
parent | 790bb5f3305e1f0ef4bc8252d620cba9d749d01b (diff) | |
download | chef-bba2a093aa7c0cda097650ce2f390ef63e648e52.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 |