Module: Chef::Provider::DeprecatedLWRPClass
- Included in:
- Chef::Provider
- Defined in:
- lib/chef/provider.rb
Instance Method Summary collapse
- #const_missing(class_name) ⇒ Object
- #register_deprecated_lwrp_class(provider_class, class_name) ⇒ Object private
Instance Method Details
#const_missing(class_name) ⇒ Object
427 428 429 430 431 432 433 434 |
# File 'lib/chef/provider.rb', line 427 def const_missing(class_name) if 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] else raise NameError, "uninitialized constant Chef::Provider::#{class_name}" end end |
#register_deprecated_lwrp_class(provider_class, class_name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
437 438 439 440 441 442 443 444 445 |
# File 'lib/chef/provider.rb', line 437 def register_deprecated_lwrp_class(provider_class, class_name) # Register Chef::Provider::MyProvider with deprecation warnings if you # try to access it 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 end end |