diff options
author | John Keiser <john@johnkeiser.com> | 2015-05-08 13:37:02 -0700 |
---|---|---|
committer | John Keiser <john@johnkeiser.com> | 2015-06-02 09:53:40 -0700 |
commit | 9a09df111e614d3e66639740d796c0479ab9b63d (patch) | |
tree | ec9e336080ea655b840d3123c631f948cfb4bb84 /lib | |
parent | ae672fafe59372c528e0fe2a74619958425ad6d5 (diff) | |
download | chef-9a09df111e614d3e66639740d796c0479ab9b63d.tar.gz |
Fix ifconfig platform version filter
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/chef_class.rb | 10 | ||||
-rw-r--r-- | lib/chef/platform/provider_priority_map.rb | 8 | ||||
-rw-r--r-- | lib/chef/platform/resource_priority_map.rb | 8 | ||||
-rw-r--r-- | lib/chef/provider/ifconfig/debian.rb | 11 | ||||
-rw-r--r-- | lib/chef/resource.rb | 6 |
5 files changed, 18 insertions, 25 deletions
diff --git a/lib/chef/chef_class.rb b/lib/chef/chef_class.rb index 96c0899d5d..7c0a2bf944 100644 --- a/lib/chef/chef_class.rb +++ b/lib/chef/chef_class.rb @@ -68,8 +68,8 @@ class Chef # @param priority_array [Class, Array<Class>] Class or Array of Classes to set as the priority for resource_name on the node # @param filter [Hash] Chef::Nodearray-style filter # @return [Array<Class>] Modified Priority Array of Provider Classes to use for the resource_name on the node - def set_provider_priority_array(resource_name, priority_array, *filter) - provider_priority_map.set_priority_array(resource_name, priority_array, *filter).dup + def set_provider_priority_array(resource_name, priority_array, *filter, &block) + provider_priority_map.set_priority_array(resource_name, priority_array, *filter, &block).dup end # Get the array of resources associated with a resource_name for the current node @@ -78,8 +78,8 @@ class Chef # @param priority_array [Class, Array<Class>] Class or Array of Classes to set as the priority for resource_name on the node # @param filter [Hash] Chef::Nodearray-style filter # @return [Array<Class>] Modified Priority Array of Resource Classes to use for the resource_name on the node - def set_resource_priority_array(resource_name, priority_array, *filter) - resource_priority_map.set_priority_array(resource_name, priority_array, *filter).dup + def set_resource_priority_array(resource_name, priority_array, *filter, &block) + resource_priority_map.set_priority_array(resource_name, priority_array, *filter, &block).dup end # @@ -135,13 +135,11 @@ class Chef def provider_priority_map @provider_priority_map ||= begin # these slurp in the resource+provider world, so be exceedingly lazy about requiring them - require 'chef/platform/provider_priority_map' Chef::Platform::ProviderPriorityMap.instance end end def resource_priority_map @resource_priority_map ||= begin - require 'chef/platform/resource_priority_map' Chef::Platform::ResourcePriorityMap.instance end end diff --git a/lib/chef/platform/provider_priority_map.rb b/lib/chef/platform/provider_priority_map.rb index 0a6c8d8b4d..9d703c9178 100644 --- a/lib/chef/platform/provider_priority_map.rb +++ b/lib/chef/platform/provider_priority_map.rb @@ -9,12 +9,8 @@ class Chef priority_map.get(node, resource_name.to_sym) end - def set_priority_array(resource_name, priority_array, *filter) - priority(resource_name.to_sym, priority_array, *filter) - end - - def priority(resource_name, priority_array, *filter) - priority_map.set(resource_name.to_sym, Array(priority_array), *filter) + def set_priority_array(resource_name, priority_array, *filter, &block) + priority_map.set(resource_name.to_sym, Array(priority_array), *filter, &block) end # @api private diff --git a/lib/chef/platform/resource_priority_map.rb b/lib/chef/platform/resource_priority_map.rb index 34f13529fe..e98fc12413 100644 --- a/lib/chef/platform/resource_priority_map.rb +++ b/lib/chef/platform/resource_priority_map.rb @@ -9,12 +9,8 @@ class Chef priority_map.get(node, resource_name.to_sym) end - def set_priority_array(resource_name, priority_array, *filter) - priority resource_name.to_sym, Array(priority_array), *filter - end - - def priority(*args) - priority_map.set(*args) + def set_priority_array(resource_name, priority_array, *filter, &block) + priority_map.set(resource_name.to_sym, Array(priority_array), *filter, &block) end # @api private diff --git a/lib/chef/provider/ifconfig/debian.rb b/lib/chef/provider/ifconfig/debian.rb index 85765a6fea..03aeae9a93 100644 --- a/lib/chef/provider/ifconfig/debian.rb +++ b/lib/chef/provider/ifconfig/debian.rb @@ -23,7 +23,16 @@ class Chef class Provider class Ifconfig class Debian < Chef::Provider::Ifconfig - provides :ifconfig, platform: %w(ubuntu >= 11.10 debian >= 7.0) + provides :ifconfig, platform: %w(ubuntu) do |node| + if node[:platform_version] + Chef::VersionConstraint::Platform.new('>= 11.10').include?(node[:platform_version]) + end + end + provides :ifconfig, platform: %w(debian) do |node| + if node[:platform_version] + Chef::VersionConstraint::Platform.new('>= 7.0').include?(node[:platform_version]) + end + end INTERFACES_FILE = "/etc/network/interfaces" INTERFACES_DOT_D_DIR = "/etc/network/interfaces.d" diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb index 0547258f42..b8bf53d6ec 100644 --- a/lib/chef/resource.rb +++ b/lib/chef/resource.rb @@ -1274,12 +1274,6 @@ class Chef end end - protected - - def self.provides_priority_map - Chef::Platform::ResourcePriorityMap.instance - end - # Implement deprecated LWRP class module DeprecatedLWRPClass # @api private |