summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/chef/resource/windows_certificate.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/chef/resource/windows_certificate.rb b/lib/chef/resource/windows_certificate.rb
index af0bca9bf0..047d8b969f 100644
--- a/lib/chef/resource/windows_certificate.rb
+++ b/lib/chef/resource/windows_certificate.rb
@@ -397,8 +397,11 @@ class Chef
state = uri.is_a?(URI::HTTP) && !uri.host.nil? ? true : false
if state
begin
- output_file = get_file_name(new_resource.source)
- local_path = ::File.join(Chef::Config[:file_cache_path], output_file)
+ output_file_name = get_file_name(new_resource.source)
+ unless Dir.exist?(Chef::Config[:file_cache_path])
+ Dir.mkdir(Chef::Config[:file_cache_path])
+ end
+ local_path = ::File.join(Chef::Config[:file_cache_path], output_file_name)
@local_pfx_path = local_path
::File.open(local_path, "wb") do |file|
file.write URI.open(new_resource.source).read