summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/chef/resource/lwrp_base.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/chef/resource/lwrp_base.rb b/lib/chef/resource/lwrp_base.rb
index 0a1cb6aa72..424efa73d9 100644
--- a/lib/chef/resource/lwrp_base.rb
+++ b/lib/chef/resource/lwrp_base.rb
@@ -78,11 +78,26 @@ class Chef
resource_class = Class.new(deprecated_resource_class).tap do |resource_class|
resource_class.resource_name(resource_name.to_sym)
+ resource_class.run_context = run_context
resource_class.instance_eval do
define_method(:chef_deprecated_access) do
false
end
end
+ resource_class.class_eval do
+ define_singleton_method(:===) do |instance|
+ super(instance) || instance.class <= deprecated_resource_class
+ end
+ end
+ end
+
+ deprecated_resource_class.class_eval do
+ define_method(:kind_of?) do |klass|
+ super(klass) || klass == resource_class
+ end
+ define_method(:is_a?) do |klass|
+ super(klass) || klass == resource_class
+ end
end
Chef::Log.debug("Loaded contents of #{filename} into resource #{resource_name} (#{resource_class})")