summaryrefslogtreecommitdiff
path: root/lib/chef/file_content_management
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2014-07-23 13:02:20 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2014-07-26 17:00:34 -0700
commit1260f551986b235c49a649dcdd374d21905be56f (patch)
tree5ce659f44833fa6b04b02d1cb06dcbebb60ae2e7 /lib/chef/file_content_management
parent2cc728f2dd85e11835d23d03f76e0e4c75ca2510 (diff)
downloadchef-1260f551986b235c49a649dcdd374d21905be56f.tar.gz
change file_staging_uses_destdir default to true
Diffstat (limited to 'lib/chef/file_content_management')
-rw-r--r--lib/chef/file_content_management/tempfile.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/chef/file_content_management/tempfile.rb b/lib/chef/file_content_management/tempfile.rb
index 0bb7f3a6fa..61a5ce2a7c 100644
--- a/lib/chef/file_content_management/tempfile.rb
+++ b/lib/chef/file_content_management/tempfile.rb
@@ -54,7 +54,14 @@ class Chef
end
def tempfile_dirname
- Chef::Config[:file_staging_uses_destdir] ? ::File.dirname(@new_resource.path) : Dir::tmpdir
+ # in why-run mode we need to create a Tempfile to compare against, which we will never
+ # wind up deploying, but our enclosing directory for the destdir may not exist yet, so
+ # instead we can reliably always create a Tempfile to compare against in Dir::tmpdir
+ if Chef::Config[:file_staging_uses_destdir] && !Chef::Config[:why_run]
+ ::File.dirname(@new_resource.path)
+ else
+ Dir::tmpdir
+ end
end
end
end