From 13a02abe2d02a59c846fb0a65d8429314652d618 Mon Sep 17 00:00:00 2001 From: aliasgar16 Date: Thu, 27 Oct 2016 17:16:20 +0530 Subject: Fixed knife download cookbooks issue which used to corrupt the certificate files each time the command was fired. Signed-off-by: aliasgar16 --- lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'lib/chef/chef_fs') 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 426cc62039..ad50054dc9 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 @@ -39,17 +39,13 @@ class Chef def read begin tmpfile = rest.streaming_request(file[:url]) + File.open(tmpfile, "rb") { |f| f.read } rescue Timeout::Error => e raise Chef::ChefFS::FileSystem::OperationFailedError.new(:read, self, e, "Timeout reading #{file[:url]}: #{e}") rescue Net::HTTPServerException => e raise Chef::ChefFS::FileSystem::OperationFailedError.new(:read, self, e, "#{e.message} retrieving #{file[:url]}") - end - - begin - tmpfile.open - tmpfile.read - ensure - tmpfile.close! + rescue Errno::ENOENT + raise Chef::ChefFS::FileSystem::NotFoundError.new(self, $!) end end -- cgit v1.2.1