From 6290f4b25e0ccf28ad738a536aba8d15ea4fd11c Mon Sep 17 00:00:00 2001 From: Ryan Cragun Date: Thu, 19 Jun 2014 18:33:17 -0700 Subject: [OC-11667] Don't overwrite the :default provider map if :default is passed as the platform --- lib/chef/platform/provider_mapping.rb | 2 ++ spec/unit/platform_spec.rb | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/lib/chef/platform/provider_mapping.rb b/lib/chef/platform/provider_mapping.rb index 4b59501d1f..3b66a0e92a 100644 --- a/lib/chef/platform/provider_mapping.rb +++ b/lib/chef/platform/provider_mapping.rb @@ -507,6 +507,8 @@ class Chef if platforms.has_key?(args[:platform]) if platforms[args[:platform]].has_key?(:default) platforms[args[:platform]][:default][args[:resource].to_sym] = args[:provider] + elsif args[:platform] == :default + platforms[:default][args[:resource].to_sym] = args[:provider] else platforms[args[:platform]] = { :default => { args[:resource].to_sym => args[:provider] } } end diff --git a/spec/unit/platform_spec.rb b/spec/unit/platform_spec.rb index 3d7aef98a0..029fc29aae 100644 --- a/spec/unit/platform_spec.rb +++ b/spec/unit/platform_spec.rb @@ -254,6 +254,16 @@ describe Chef::Platform do end + it "does not overwrite the platform map when using :default platform" do + Chef::Platform.set( + :resource => :file, + :platform => :default, + :provider => "new school" + ) + Chef::Platform.platforms[:default][:file].should eql("new school") + Chef::Platform.platforms[:default][:cat].should eql("nice") + end + end context "while testing the configured platform data" do -- cgit v1.2.1