summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Chamberland <chamberland.marc@gmail.com>2019-12-17 17:29:38 -0500
committerMarc Chamberland <chamberland.marc@gmail.com>2019-12-18 15:41:45 -0500
commit6f2ad0e95c7083fd4cb526ab36388afa6403bf47 (patch)
treebeabb153ef063da6c8689b64e31925a594311a29
parentcd444f5dfd39e4494e0a8495b20b39259dab923a (diff)
downloadchef-6f2ad0e95c7083fd4cb526ab36388afa6403bf47.tar.gz
apply ownership to extracted files only
Signed-off-by: Marc Chamberland <chamberland.marc@gmail.com>
-rw-r--r--lib/chef/resource/archive_file.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/chef/resource/archive_file.rb b/lib/chef/resource/archive_file.rb
index dd208fb60f..58681ecb47 100644
--- a/lib/chef/resource/archive_file.rb
+++ b/lib/chef/resource/archive_file.rb
@@ -102,8 +102,11 @@ class Chef
end
if new_resource.owner || new_resource.group
- converge_by("set owner of #{new_resource.destination} to #{new_resource.owner}:#{new_resource.group}") do
- FileUtils.chown_R(new_resource.owner, new_resource.group, new_resource.destination)
+ converge_by("set owner of files extracted in #{new_resource.destination} to #{new_resource.owner}:#{new_resource.group}") do
+ archive = Archive::Reader.open_filename(new_resource.path)
+ archive.each_entry do |e|
+ FileUtils.chown(new_resource.owner, new_resource.group, "#{new_resource.destination}/#{e.pathname}")
+ end
end
end
end