summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/chef/platform/provider_mapping.rb2
-rw-r--r--spec/unit/platform_spec.rb10
2 files changed, 12 insertions, 0 deletions
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