Module: Chef::Provider::DeprecatedLWRPClass

Included in:
Chef::Provider
Defined in:
lib/chef/provider.rb

Instance Method Summary collapse

Instance Method Details

#const_missing(class_name) ⇒ Object



424
425
426
427
428
429
430
431
# File 'lib/chef/provider.rb', line 424

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.



434
435
436
437
438
439
440
441
442
# File 'lib/chef/provider.rb', line 434

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