summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLincoln Baker <lbaker@chef.io>2022-01-18 10:28:10 -0600
committerLincoln Baker <lbaker@chef.io>2022-01-18 11:02:06 -0600
commit0d9136e6c4425cfb170808ef02bf516938c6ed2c (patch)
tree88a3b9f78685db52e631cc50631f97aa1f646317
parent909e1e1177ca17f6e5ec0dff0920c4bfb9def0da (diff)
downloadchef-lbaker/purge.tar.gz
Delete node and client ALCs on --purge optionlbaker/purge
Signed-off-by: Lincoln Baker <lbaker@chef.io>
-rw-r--r--lib/chef/chef_fs/file_system.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/chef/chef_fs/file_system.rb b/lib/chef/chef_fs/file_system.rb
index 5c4278c100..de3efb4b82 100644
--- a/lib/chef/chef_fs/file_system.rb
+++ b/lib/chef/chef_fs/file_system.rb
@@ -288,6 +288,8 @@ class Chef
else
begin
dest_entry.delete(true)
+ # if this is a node or client, delete associated ACLs (user ACLs handled elsewhere)
+ ::File.delete "#{dest_entry.parent.file_path}/../acls#{dest_path}" if ['/nodes', '/clients'].include? Pathname.new(dest_path).parent.to_s
ui.output "Deleted extra entry #{dest_path} (purge is on)" if ui
rescue Chef::ChefFS::FileSystem::NotFoundError
ui.output "Entry #{dest_path} does not exist. Nothing to do. (purge is on)" if ui