summaryrefslogtreecommitdiff
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
parent2cc728f2dd85e11835d23d03f76e0e4c75ca2510 (diff)
downloadchef-1260f551986b235c49a649dcdd374d21905be56f.tar.gz
change file_staging_uses_destdir default to true
-rw-r--r--CHANGELOG.md1
-rw-r--r--RELEASE_NOTES.md9
-rw-r--r--lib/chef/config.rb2
-rw-r--r--lib/chef/file_content_management/tempfile.rb9
4 files changed, 19 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e38c8160b1..81b7ec01e1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@
* [**Xabier de Zuazo**](https://github.com/zuazo):
Remove the unused StreamingCookbookUploader class (CHEF-4586)
+* set file_stating_uses_destdir config option default to true (CHEF-5040)
* remove dependency on rest-client gem
* Add method shell_out_with_systems_locale to ShellOut.
* Fix knife cookbook site share on windows (CHEF-4994)
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index e550382238..16bd09b67e 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -1,5 +1,14 @@
# Chef Client Release Notes:
+## Changed file_staging_uses_destdir Config default to True
+
+Staging into the system's tempdir (usually /tmp or /var/tmp) rather than the destination directory can
+cause issues with permissions or available space. It can also become problematic when doing cross-devices
+renames which turn move operations into copy operations (using mv uses a new inode on Unix which avoids
+ETXTBSY exceptions, while cp reuses the inode and can raise that error). Staging the tempfile for the
+Chef file providers into the destination directory solve these problems for users. Windows ACLs on the
+directory will also be inherited correctly.
+
## Removed Rest-Client dependency
- cookbooks that previously were able to use rest-client directly will now need to install it via `chef_gem "rest-client"`.
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