diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2014-07-23 13:02:20 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2014-07-26 17:00:34 -0700 |
commit | 1260f551986b235c49a649dcdd374d21905be56f (patch) | |
tree | 5ce659f44833fa6b04b02d1cb06dcbebb60ae2e7 /lib/chef | |
parent | 2cc728f2dd85e11835d23d03f76e0e4c75ca2510 (diff) | |
download | chef-1260f551986b235c49a649dcdd374d21905be56f.tar.gz |
change file_staging_uses_destdir default to true
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/config.rb | 2 | ||||
-rw-r--r-- | lib/chef/file_content_management/tempfile.rb | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/chef/config.rb b/lib/chef/config.rb index 65952b8cf7..929138488c 100644 --- a/lib/chef/config.rb +++ b/lib/chef/config.rb @@ -567,7 +567,7 @@ class Chef # If false file staging is will be done via tempfiles that are # created under ENV['TMP'] otherwise tempfiles will be created in # the directory that files are going to reside. - default :file_staging_uses_destdir, false + default :file_staging_uses_destdir, true # Exit if another run is in progress and the chef-client is unable to # get the lock before time expires. If nil, no timeout is enforced. (Exits 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 |