I developed a trick that I find pretty neat. I created the following definition (and put it in definitions/default.rb):
define :file_from_network, :action => :create do
myPath = (params[:path] || params[:name])
mySource = params[:source]
if File.exist?(mySource)
file myPath do
action params[:action]
content File.open(mySource) {|io| io.read}
end
else
Chef::Log.error("File #{mySource} not found!")
end
end
, , , . , , Chef , , .