I've tried to execute a RemoteFile Provider from a ruby_block using what I could cobble together from the internet. Eventually I am settled on this gist giving me the best template to go by. Essentially from what I can read there from a comment 15 days ago this following code should work:
ruby_block "parse-json" do
block do
f = Chef::Provider::File::RemoteFile.new("/tmp/googlebackup", run_context)
f.source "http://google.com"
f.run_action :create
end
action :create
end
But all it gives me is this error:
[2014-03-28T14:26:08+00:00] ERROR: ruby_block[parse-json] (/tmp/kitchen/cookbooks/jenkins_build_artefact/providers/default.rb line 16) had an error: NoMethodError: No resource or method named `source' for `Chef::Provider::RemoteFile ""'
I don't understand what exactly I am doing wrong and I literally can't find any example of anyone doing something like this anywhere on internet.
You are using Chef::Provider where you should be using Chef::Resource.
ruby_block "parse-json" do
block do
f = Chef::Resource::File::RemoteFile.new("/tmp/googlebackup", run_context)
f.source "http://google.com"
f.run_action :create
end
action :create
end