Module: Chef::Resource::DeprecatedLWRPClass

Included in:
Chef::Resource
Defined in:
lib/chef/resource.rb

Instance Method Summary collapse

Instance Method Details

#deprecated_constantsObject



1572
1573
1574
1575
# File 'lib/chef/resource.rb', line 1572

def deprecated_constants
  raise "Deprecated constants should be called only on Chef::Resource" unless self == Chef::Resource
  @deprecated_constants ||= {}
end

#register_deprecated_lwrp_class(resource_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.



1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
# File 'lib/chef/resource.rb', line 1560

def register_deprecated_lwrp_class(resource_class, class_name)
  if Chef::Resource.const_defined?(class_name, false)
    Chef::Log.warn "#{class_name} already exists!  Deprecation class overwrites #{resource_class}"
    Chef::Resource.send(:remove_const, class_name)
  end

  if !Chef::Config[:treat_deprecation_warnings_as_errors]
    Chef::Resource.const_set(class_name, resource_class)
    Chef::Resource.deprecated_constants[class_name.to_sym] = resource_class
  end
end