diff options
author | Noah Kantrowitz <noah@coderanger.net> | 2016-03-24 15:53:01 -0700 |
---|---|---|
committer | Noah Kantrowitz <noah@coderanger.net> | 2016-03-24 15:53:01 -0700 |
commit | 3f4c58c1c17214695bf90b715c7e155a76902b16 (patch) | |
tree | 627e7af7390382bb37a3c2e6a80f12f089c4e44e | |
parent | fb2c03d2c5509b7781f32278a872f39fd7f426b1 (diff) | |
download | chef-3f4c58c1c17214695bf90b715c7e155a76902b16.tar.gz |
Set inherit=false on the fallback constant lookup.
This prevents really weirdo behavior with relative constant lookups like
`Chef::Provider.const_get('Resource')` == `ChefVaultCookbook::Resource`.
-rw-r--r-- | lib/chef/platform/provider_mapping.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/chef/platform/provider_mapping.rb b/lib/chef/platform/provider_mapping.rb index 3e90797802..40474242f0 100644 --- a/lib/chef/platform/provider_mapping.rb +++ b/lib/chef/platform/provider_mapping.rb @@ -200,10 +200,10 @@ class Chef class_name = resource_type.class.name ? resource_type.class.name.split("::").last : convert_to_class_name(resource_type.resource_name.to_s) - if Chef::Provider.const_defined?(class_name) + if Chef::Provider.const_defined?(class_name, false) Chef::Log.warn("Class Chef::Provider::#{class_name} does not declare 'provides #{convert_to_snake_case(class_name).to_sym.inspect}'.") Chef::Log.warn("This will no longer work in Chef 13: you must use 'provides' to use the resource's DSL.") - return Chef::Provider.const_get(class_name) + return Chef::Provider.const_get(class_name, false) end end nil |