summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Mundrawala <jdmundrawala@gmail.com>2014-12-08 09:52:50 -0800
committerJay Mundrawala <jdmundrawala@gmail.com>2014-12-08 09:52:50 -0800
commit3eb9ed3c89d70d6801280a0b6964236c9a0c4f38 (patch)
tree60668871c27464c8656b2e90744f3d79325607ee
parenta45716b67a2168c21b166e4aab38668e9b96d856 (diff)
parent5572a91f0b7fa0af6adad4c5ada90f041bc467ce (diff)
downloadchef-3eb9ed3c89d70d6801280a0b6964236c9a0c4f38.tar.gz
Merge pull request #2554 from opscode/jdm/lwrp-provides
Fix issue where LWRP resources using `provides` fails
-rw-r--r--lib/chef/provider/lwrp_base.rb4
-rw-r--r--lib/chef/resource/lwrp_base.rb2
-rw-r--r--spec/data/lwrp/providers/buck_passer.rb1
-rw-r--r--spec/data/lwrp/resources/bar.rb1
4 files changed, 4 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
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
diff --git a/spec/data/lwrp/resources/bar.rb b/spec/data/lwrp/resources/bar.rb
index bded6eeac3..b6359648db 100644
--- a/spec/data/lwrp/resources/bar.rb
+++ b/spec/data/lwrp/resources/bar.rb
@@ -1 +1,2 @@
+provides "lwrp_bar" # This makes sure that we cover the case of lwrps using provides
actions :pass_buck, :prepare_eyes, :watch_paint_dry