Module: Chef::Provider::DeprecatedLWRPClass
- Included in:
- Chef::Provider
- Defined in:
- lib/chef/provider.rb
Instance Method Summary collapse
- #const_missing(class_name) ⇒ Object
- #deprecated_constants ⇒ Object
- #register_deprecated_lwrp_class(provider_class, class_name) ⇒ Object private
Instance Method Details
#const_missing(class_name) ⇒ Object
425 426 427 428 429 430 431 432 |
# File 'lib/chef/provider.rb', line 425 def const_missing(class_name) 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.") Chef::Provider.deprecated_constants[class_name.to_sym] else raise NameError, "uninitialized constant Chef::Provider::#{class_name}" end end |
#deprecated_constants ⇒ Object
445 446 447 448 |
# File 'lib/chef/provider.rb', line 445 def deprecated_constants raise "Deprecated constants should be called only on Chef::Provider" unless self == Chef::Provider @deprecated_constants ||= {} 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.
435 436 437 438 439 440 441 442 443 |
# File 'lib/chef/provider.rb', line 435 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 Chef::Provider.deprecated_constants[class_name.to_sym] = provider_class end end |