3) Chef::Resource::Ifconfig when it is a new Debian platform it should behave like being a platform based on a recent Debian should use an Ifconfig::Debian as a provider for debian 7.0
Failure/Error: @resource.provider_for_action(:add).should be_a_kind_of(Chef::Provider::Ifconfig::Debian)
expected #<Chef::Provider::Ifconfig:0x7f9ab248a3b0 @current_resource=nil, @config_template=nil, @action=:add, @converge_actions=nil, @run_context=#<Chef::RunContext:0x7f9ab248b5a8 @resource_collection=#<Chef::ResourceCollection:0x7f9ab248b490 @resources=[], @insert_after_idx=nil, @resources_by_name={}>, @definitions={}, @cookbook_collection={}, @delayed_notification_collection={}, @loaded_attributes={}, @events=#<Chef::EventDispatch::Dispatcher:0x7f9ab248c160 @subscribers=[]>, @immediate_notification_collection={}, @node=#<Chef::Node:0x7f9ab248c1b0 @chef_environment="_default", @name=nil, @run_state={}, @attributes=#<Chef::Node::Attribute @default={}, @env_default={}, @role_default={}, @force_default={}, @normal={}, @override={}, @role_override={}, @env_override={}, @force_override={}, @automatic={"platform"=>"debian", "platform_version"=>"7.0"}, @merged_attributes={"platform"=>"debian", "platform_version"=>"7.0"}, @properties=nil>, @run_context=#<Chef::RunContext:0x7f9ab248b5a8 ...>, @run_list=#<Chef::RunList:0x7f9ab248c0c0 @run_list_items=[]>>, @loaded_recipes={}>, @new_resource=<ifconfig[fakey_fakerton] @mtu: nil @noop: nil @hwaddr: nil @resource_name: :ifconfig @retries: 0 @onboot: nil @target: "fakey_fakerton" @updated: false @bcast: nil @action: :add @params: {} @name: "fakey_fakerton" @onparent: nil @ignore_failure: false @allowed_actions: [:nothing, :add, :delete, :enable, :disable] @device: nil @provider: nil @inet_addr: nil @elapsed_time: 0 @bootproto: nil @supports: {} @metric: nil @before: nil @mask: nil @source_line: nil @retry_delay: 2 @network: nil @updated_by_last_action: false>, @config_path=nil> to be a kind of Chef::Provider::Ifconfig::Debian
Shared Example Group: "being a platform based on a recent Debian" called from /home/btm/src/chef/spec/unit/resource/ifconfig_spec.rb:94
# /home/btm/src/chef/spec/unit/resource/ifconfig_spec.rb:81
4) Chef::Resource::Ifconfig when it is a new Ubuntu platform it should behave like being a platform based on a recent Debian should use an Ifconfig::Debian as a provider for ubuntu 11.10
Failure/Error: @resource.provider_for_action(:add).should be_a_kind_of(Chef::Provider::Ifconfig::Debian)
expected #<Chef::Provider::Ifconfig:0x7f9ab246b398 @current_resource=nil, @config_template=nil, @action=:add, @converge_actions=nil, @run_context=#<Chef::RunContext:0x7f9ab246bf78 @resource_collection=#<Chef::ResourceCollection:0x7f9ab246be38 @resources=[], @insert_after_idx=nil, @resources_by_name={}>, @definitions={}, @cookbook_collection={}, @delayed_notification_collection={}, @loaded_attributes={}, @events=#<Chef::EventDispatch::Dispatcher:0x7f9ab246cd88 @subscribers=[]>, @immediate_notification_collection={}, @node=#<Chef::Node:0x7f9ab246cdd8 @chef_environment="_default", @name=nil, @run_state={}, @attributes=#<Chef::Node::Attribute @default={}, @env_default={}, @role_default={}, @force_default={}, @normal={}, @override={}, @role_override={}, @env_override={}, @force_override={}, @automatic={"platform"=>"ubuntu", "platform_version"=>"11.10"}, @merged_attributes={"platform"=>"ubuntu", "platform_version"=>"11.10"}, @properties=nil>, @run_context=#<Chef::RunContext:0x7f9ab246bf78 ...>, @run_list=#<Chef::RunList:0x7f9ab246cd10 @run_list_items=[]>>, @loaded_recipes={}>, @new_resource=<ifconfig[fakey_fakerton] @mtu: nil @noop: nil @hwaddr: nil @resource_name: :ifconfig @retries: 0 @onboot: nil @target: "fakey_fakerton" @updated: false @bcast: nil @action: :add @params: {} @name: "fakey_fakerton" @onparent: nil @ignore_failure: false @allowed_actions: [:nothing, :add, :delete, :enable, :disable] @device: nil @provider: nil @inet_addr: nil @elapsed_time: 0 @bootproto: nil @supports: {} @metric: nil @before: nil @mask: nil @source_line: nil @retry_delay: 2 @network: nil @updated_by_last_action: false>, @config_path=nil> to be a kind of Chef::Provider::Ifconfig::Debian
Shared Example Group: "being a platform based on a recent Debian" called from /home/btm/src/chef/spec/unit/resource/ifconfig_spec.rb:102
# /home/btm/src/chef/spec/unit/resource/ifconfig_spec.rb:81
I know this patch may cause controversy, don't worry
Here's my first attempt.
https://github.com/opscode/chef/pull/635
Any ideas to improve the patch, problems or questions?
Some notes:
I reused Chef::Version and integrated it with Chef::Platform to support ">=" in platform versions.Maybe not quite fit: the exception Chef::Version throws is called InvalidCookbookVersion, perhaps this should be changed.By the way: this exception is ignored inside Chef::Platform.I also changed Chef::Version to support single digit in version names (for example cookbook version "1"), it is possible that you do not agree with this, but my idea is to try to reuse that class. IMHO not being able to make comparisons with single digit versions inside Chef::Platform would be weird, but it is not a requirement right now, so this change can be reverted.Deleted linesmove toCHEF-3919.