Module: Chef::Resource::DeprecatedLWRPClass

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

Instance Method Summary collapse

Instance Method Details

#deprecated_constantsObject



1596
1597
1598
1599
# File 'lib/chef/resource.rb', line 1596

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.



1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
# File 'lib/chef/resource.rb', line 1584

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