summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJohn Keiser <john@johnkeiser.com>2015-05-01 22:05:58 -0700
committerJohn Keiser <john@johnkeiser.com>2015-05-13 13:43:14 -0700
commitc17e5eda5f76e7abfbac904a0d5536ee6321cd61 (patch)
tree48710d222e14532804b62f14545fb1a96f116eb4 /lib
parentf25d2527b2ad8c45731ad5268fcd2a89e26f097d (diff)
downloadchef-c17e5eda5f76e7abfbac904a0d5536ee6321cd61.tar.gz
Add deprecation warning for providers that do not use provides
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/platform/provider_mapping.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/chef/platform/provider_mapping.rb b/lib/chef/platform/provider_mapping.rb
index 0d7285729f..763ae79368 100644
--- a/lib/chef/platform/provider_mapping.rb
+++ b/lib/chef/platform/provider_mapping.rb
@@ -292,6 +292,8 @@ class Chef
:user => Chef::Provider::User::Useradd,
:group => Chef::Provider::Group::Gpasswd,
:ifconfig => Chef::Provider::Ifconfig,
+ :package => Chef::Provider::Package,
+ :service => Chef::Provider::Service,
}
}
end
@@ -463,7 +465,11 @@ class Chef
def resource_matching_provider(platform, version, resource_type)
if resource_type.kind_of?(Chef::Resource)
begin
- Chef::Provider.const_get(resource_type.class.to_s.split('::').last)
+ class_name = resource_type.class.to_s.split('::').last
+ result = Chef::Provider.const_get(class_name)
+ Chef::Log.warn("Class Chef::Provider::#{class_name} does not declare 'provides #{resource_type.class.dsl_name.to_sym.inspect}'.")
+ Chef::Log.warn("This will no longer work in Chef 13: you must use 'provides' to provide DSL.")
+ result
rescue NameError
nil
end