diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2018-08-03 14:38:03 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2018-08-03 14:38:03 -0700 |
commit | 83ab18515911416ae3622dbcfd44c2ce56b76546 (patch) | |
tree | 4ed70f284155027c8052d5df797c59bc05104d47 /lib/chef/node_map.rb | |
parent | 628b6189201c532ae0e3ff962b324018911ff389 (diff) | |
download | chef-83ab18515911416ae3622dbcfd44c2ce56b76546.tar.gz |
add chef_version API to provides lines
also adds the chef_version_for_provides helper method
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/node_map.rb')
-rw-r--r-- | lib/chef/node_map.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/chef/node_map.rb b/lib/chef/node_map.rb index 62efbc12d6..9c3d223181 100644 --- a/lib/chef/node_map.rb +++ b/lib/chef/node_map.rb @@ -71,7 +71,7 @@ EOH # # @return [NodeMap] Returns self for possible chaining # - def set(key, klass, platform: nil, platform_version: nil, platform_family: nil, os: nil, canonical: nil, override: nil, allow_cookbook_override: false, __core_override__: false, &block) # rubocop:disable Lint/UnderscorePrefixedVariableName + def set(key, klass, platform: nil, platform_version: nil, platform_family: nil, os: nil, canonical: nil, override: nil, allow_cookbook_override: false, __core_override__: false, chef_version: nil, &block) # rubocop:disable Lint/UnderscorePrefixedVariableName new_matcher = { klass: klass } new_matcher[:platform] = platform if platform new_matcher[:platform_version] = platform_version if platform_version @@ -83,6 +83,10 @@ EOH new_matcher[:cookbook_override] = allow_cookbook_override new_matcher[:core_override] = __core_override__ + if chef_version && Chef::VERSION !~ chef_version + return map + end + # Check if the key is already present and locked, unless the override is allowed. # The checks to see if we should reject, in order: # 1. Core override mode is not set. |