summaryrefslogtreecommitdiff
path: root/lib/chef/provider.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/provider.rb')
-rw-r--r--lib/chef/provider.rb9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/chef/provider.rb b/lib/chef/provider.rb
index 03b546c09d..7cfddba0cb 100644
--- a/lib/chef/provider.rb
+++ b/lib/chef/provider.rb
@@ -423,9 +423,9 @@ class Chef
module DeprecatedLWRPClass
def const_missing(class_name)
- if deprecated_constants[class_name.to_sym]
+ if Chef::Provider.deprecated_constants[class_name.to_sym]
Chef.log_deprecation("Using an LWRP provider by its name (#{class_name}) directly is no longer supported in Chef 12 and will be removed. Use Chef::ProviderResolver.new(node, resource, action) instead.")
- deprecated_constants[class_name.to_sym]
+ Chef::Provider.deprecated_constants[class_name.to_sym]
else
raise NameError, "uninitialized constant Chef::Provider::#{class_name}"
end
@@ -438,13 +438,12 @@ class Chef
if Chef::Provider.const_defined?(class_name, false)
Chef::Log.warn "Chef::Provider::#{class_name} already exists! Cannot create deprecation class for #{provider_class}"
else
- deprecated_constants[class_name.to_sym] = provider_class
+ Chef::Provider.deprecated_constants[class_name.to_sym] = provider_class
end
end
- private
-
def deprecated_constants
+ raise "Deprecated constants should be called only on Chef::Provider" unless self == Chef::Provider
@deprecated_constants ||= {}
end
end