def action_create
Chef::Log.debug("#{@new_resource} checking for changes")
if current_resource_matches_target_checksum?
Chef::Log.debug("#{@new_resource} checksum matches target checksum (#{@new_resource.checksum}) - not updating")
else
rest = Chef::REST.new(@new_resource.source, nil, nil, http_client_opts)
raw_file = rest.streaming_request(rest.create_url(@new_resource.source), {})
if matches_current_checksum?(raw_file)
Chef::Log.debug "#{@new_resource} target and source checksums are the same - not updating"
else
description = []
description << "copy file downloaded from #{@new_resource.source} into #{@new_resource.path}"
description << diff_current(raw_file.path)
converge_by(description) do
backup_new_resource
FileUtils.cp raw_file.path, @new_resource.path
Chef::Log.info "#{@new_resource} updated"
raw_file.close!
end
if whyrun_mode?
raw_file.close!
end
end
end
set_all_access_controls
end