diff options
Diffstat (limited to 'lib')
5 files changed, 5 insertions, 5 deletions
diff --git a/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb b/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb index c49ed51d81..35e412bd37 100644 --- a/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb +++ b/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb @@ -38,7 +38,7 @@ class Chef def read tmpfile = rest.streaming_request(file[:url]) - File.open(tmpfile, "rb", &:read) + File.binread(tmpfile) rescue Timeout::Error => e raise Chef::ChefFS::FileSystem::OperationFailedError.new(:read, self, e, "Timeout reading #{file[:url]}: #{e}") rescue Net::HTTPClientException => e diff --git a/lib/chef/chef_fs/file_system/repository/base_file.rb b/lib/chef/chef_fs/file_system/repository/base_file.rb index 94b52b9201..46c6494bb7 100644 --- a/lib/chef/chef_fs/file_system/repository/base_file.rb +++ b/lib/chef/chef_fs/file_system/repository/base_file.rb @@ -123,7 +123,7 @@ class Chef if is_ruby_file? data_handler.from_ruby(file_path).to_json else - File.open(file_path, "rb", &:read) + File.binread(file_path) end rescue Errno::ENOENT raise Chef::ChefFS::FileSystem::NotFoundError.new(self, $!) diff --git a/lib/chef/chef_fs/file_system/repository/file_system_entry.rb b/lib/chef/chef_fs/file_system/repository/file_system_entry.rb index 902bc63038..289ec26058 100644 --- a/lib/chef/chef_fs/file_system/repository/file_system_entry.rb +++ b/lib/chef/chef_fs/file_system/repository/file_system_entry.rb @@ -126,7 +126,7 @@ class Chef end def read - File.open(file_path, "rb", &:read) + File.binread(file_path) rescue Errno::ENOENT raise Chef::ChefFS::FileSystem::NotFoundError.new(self, $!) end diff --git a/lib/chef/cookbook_uploader.rb b/lib/chef/cookbook_uploader.rb index 21a15f706c..6b71b26d0c 100644 --- a/lib/chef/cookbook_uploader.rb +++ b/lib/chef/cookbook_uploader.rb @@ -119,7 +119,7 @@ class Chef # but we need the base64 encoding for the content-md5 # header checksum64 = Base64.encode64([checksum].pack("H*")).strip - file_contents = File.open(file, "rb", &:read) + file_contents = File.binread(file) # Custom headers. 'content-type' disables JSON serialization of the request body. headers = { "content-type" => "application/x-binary", "content-md5" => checksum64, "accept" => "application/json" } diff --git a/lib/chef/util/dsc/configuration_generator.rb b/lib/chef/util/dsc/configuration_generator.rb index 8ca6249a9d..ae3c5c951d 100644 --- a/lib/chef/util/dsc/configuration_generator.rb +++ b/lib/chef/util/dsc/configuration_generator.rb @@ -175,7 +175,7 @@ class Chef::Util::DSC end def get_configuration_document(document_path) - ::File.open(document_path, "rb", &:read) + ::File.binread(document_path) end end end |