From 02e30cf7d3236e2fb3b80fc89835922ca7cb245c Mon Sep 17 00:00:00 2001 From: Jay Mundrawala Date: Fri, 5 Dec 2014 16:34:57 -0800 Subject: Added a provides to lwrp in spec to cover that case Note -- This test fails --- spec/data/lwrp/resources/bar.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/data/lwrp/resources/bar.rb b/spec/data/lwrp/resources/bar.rb index bded6eeac3..fafd0ec992 100644 --- a/spec/data/lwrp/resources/bar.rb +++ b/spec/data/lwrp/resources/bar.rb @@ -1 +1,2 @@ +provides "lwrp_bar" actions :pass_buck, :prepare_eyes, :watch_paint_dry -- cgit v1.2.1 From c9a31edeaf2fdd14d72ad87ca83d3489718455f1 Mon Sep 17 00:00:00 2001 From: Jay Mundrawala Date: Fri, 5 Dec 2014 16:40:13 -0800 Subject: Fix issue where LWRP resources using `provides` fails --- lib/chef/provider/lwrp_base.rb | 4 +--- lib/chef/resource/lwrp_base.rb | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/chef/provider/lwrp_base.rb b/lib/chef/provider/lwrp_base.rb index 135a3f6b7c..121abf5fdb 100644 --- a/lib/chef/provider/lwrp_base.rb +++ b/lib/chef/provider/lwrp_base.rb @@ -92,10 +92,8 @@ class Chef 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) + provider_class.class_from_file(filename) Chef::Log.debug("Loaded contents of #{filename} into a provider named #{provider_name} defined in Chef::Provider::#{class_name}") end diff --git a/lib/chef/resource/lwrp_base.rb b/lib/chef/resource/lwrp_base.rb index a4606be842..20d177f507 100644 --- a/lib/chef/resource/lwrp_base.rb +++ b/lib/chef/resource/lwrp_base.rb @@ -46,11 +46,11 @@ class Chef else resource_class = Class.new(self) + Chef::Resource.const_set(class_name, resource_class) resource_class.resource_name = rname resource_class.run_context = run_context resource_class.class_from_file(filename) - Chef::Resource.const_set(class_name, resource_class) Chef::Log.debug("Loaded contents of #{filename} into a resource named #{rname} defined in Chef::Resource::#{class_name}") end -- cgit v1.2.1 From 210beca7f05ad05443cf8876ca5afe915e32acc6 Mon Sep 17 00:00:00 2001 From: Jay Mundrawala Date: Fri, 5 Dec 2014 16:41:53 -0800 Subject: Added comment about change in bar.rb --- spec/data/lwrp/resources/bar.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/data/lwrp/resources/bar.rb b/spec/data/lwrp/resources/bar.rb index fafd0ec992..b6359648db 100644 --- a/spec/data/lwrp/resources/bar.rb +++ b/spec/data/lwrp/resources/bar.rb @@ -1,2 +1,2 @@ -provides "lwrp_bar" +provides "lwrp_bar" # This makes sure that we cover the case of lwrps using provides actions :pass_buck, :prepare_eyes, :watch_paint_dry -- cgit v1.2.1 From 5572a91f0b7fa0af6adad4c5ada90f041bc467ce Mon Sep 17 00:00:00 2001 From: Jay Mundrawala Date: Mon, 8 Dec 2014 08:50:27 -0800 Subject: Added provides to provider in spec --- spec/data/lwrp/providers/buck_passer.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/data/lwrp/providers/buck_passer.rb b/spec/data/lwrp/providers/buck_passer.rb index 8d5156af81..c56ab94f85 100644 --- a/spec/data/lwrp/providers/buck_passer.rb +++ b/spec/data/lwrp/providers/buck_passer.rb @@ -1,3 +1,4 @@ +provides 'buck_passer' action :pass_buck do lwrp_foo :prepared_thumbs do action :prepare_thumbs -- cgit v1.2.1