summaryrefslogtreecommitdiff
path: root/lib/chef/provider/lwrp_base.rb
diff options
context:
space:
mode:
authorSerdar Sutay <serdar@opscode.com>2014-10-08 14:55:33 -0700
committerSerdar Sutay <serdar@opscode.com>2014-10-08 15:01:30 -0700
commit02fb9664331e88f1abc159bc673f813e9299952a (patch)
tree796587a6a684518b7d4f893c2e6137c55d8ddc13 /lib/chef/provider/lwrp_base.rb
parent7f236885e421954ba39e6daf0d9da30b16b04040 (diff)
downloadchef-02fb9664331e88f1abc159bc673f813e9299952a.tar.gz
Don't override LWRP resources or providers anymore in Chef 12.
Diffstat (limited to 'lib/chef/provider/lwrp_base.rb')
-rw-r--r--lib/chef/provider/lwrp_base.rb19
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/chef/provider/lwrp_base.rb b/lib/chef/provider/lwrp_base.rb
index 90ce70ae61..7c5249fd4e 100644
--- a/lib/chef/provider/lwrp_base.rb
+++ b/lib/chef/provider/lwrp_base.rb
@@ -81,22 +81,25 @@ class Chef
include Chef::DSL::DataQuery
def self.build_from_file(cookbook_name, filename, run_context)
+ provider_class = nil
provider_name = filename_to_qualified_string(cookbook_name, filename)
# Add log entry if we override an existing light-weight provider.
class_name = convert_to_class_name(provider_name)
if Chef::Provider.const_defined?(class_name)
- Chef::Log.info("#{class_name} light-weight provider already initialized -- overriding!")
+ Chef::Log.info("#{class_name} light-weight provider is already initialized -- Skipping loading #{filename}!")
+ Chef::Log.debug("Overriding already defined LWRPs is not supported anymore starting with Chef 12.")
+ provider_class = Chef::Provider.const_get(class_name)
+ else
+ provider_class = Class.new(self)
+ provider_class.class_from_file(filename)
+
+ class_name = convert_to_class_name(provider_name)
+ Chef::Provider.const_set(class_name, provider_class)
+ Chef::Log.debug("Loaded contents of #{filename} into a provider named #{provider_name} defined in Chef::Provider::#{class_name}")
end
- provider_class = Class.new(self)
- provider_class.class_from_file(filename)
-
- class_name = convert_to_class_name(provider_name)
- Chef::Provider.const_set(class_name, provider_class)
- Chef::Log.debug("Loaded contents of #{filename} into a provider named #{provider_name} defined in Chef::Provider::#{class_name}")
-
provider_class
end