Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue where LWRP resources using provides fails #2554

Merged
merged 4 commits into from
Dec 8, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions lib/chef/provider/lwrp_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,8 @@ def self.build_from_file(cookbook_name, filename, run_context)
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

Expand Down
2 changes: 1 addition & 1 deletion lib/chef/resource/lwrp_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ def self.build_from_file(cookbook_name, filename, run_context)
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

Expand Down
1 change: 1 addition & 0 deletions spec/data/lwrp/providers/buck_passer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
provides 'buck_passer'
action :pass_buck do
lwrp_foo :prepared_thumbs do
action :prepare_thumbs
Expand Down
1 change: 1 addition & 0 deletions spec/data/lwrp/resources/bar.rb
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
provides "lwrp_bar" # This makes sure that we cover the case of lwrps using provides
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could also throw the same line into the provider as well i think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no bar provider, i can throw it in another provider...maybe buck_passer?

actions :pass_buck, :prepare_eyes, :watch_paint_dry