diff options
author | Aubrey Holland <aubreyholland@gmail.com> | 2015-09-28 16:46:15 -0400 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2015-10-24 20:25:12 -0700 |
commit | 33a175a62c88a7bcfbe92040a56244a91dcef8b3 (patch) | |
tree | 0e462bc4be5d136e983ed0c353111d36f24742e8 | |
parent | 8b8e264e996c683b058a54f34ffd125229358337 (diff) | |
download | chef-33a175a62c88a7bcfbe92040a56244a91dcef8b3.tar.gz |
fix errors when files go away during chown
The deploy resource attempts to change the owner of all files in the
deploy directory, but it breaks when files are removed during the
process. This is because FileUtils::chown_R gets a list of the files and
then walks through and updates them, and if that takes any time at all
then files may be deleted during the process. When this happens, the
deploy will fail with Errno::ENOENT. chown_R takes an options hash with
:force as one of the available options, and the only thing it does is
stop errors from being raised under these circumstances.
-rw-r--r-- | lib/chef/provider/deploy.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/chef/provider/deploy.rb b/lib/chef/provider/deploy.rb index 77a0410593..c59200e717 100644 --- a/lib/chef/provider/deploy.rb +++ b/lib/chef/provider/deploy.rb @@ -276,7 +276,7 @@ class Chef def enforce_ownership converge_by("force ownership of #{@new_resource.deploy_to} to #{@new_resource.group}:#{@new_resource.user}") do - FileUtils.chown_R(@new_resource.user, @new_resource.group, @new_resource.deploy_to) + FileUtils.chown_R(@new_resource.user, @new_resource.group, @new_resource.deploy_to, :force => true) Chef::Log.info("#{@new_resource} set user to #{@new_resource.user}") if @new_resource.user Chef::Log.info("#{@new_resource} set group to #{@new_resource.group}") if @new_resource.group end |