the resource_directory
has only 2 actions available: create
and delete
I need to update the owner and group of a directory recursi
You can set the default action to nothing then have resources that may screw things up notify the perm fixer:
execute "chown-data-www" do
command "chown -R www-data:www-data /var/www/myfoler"
user "root"
action :nothing
end
resource "that may screw up perms" do
stuff "one two three"
notifies :run, execute "chown-data-www"
end
with more options you could have the action :run but not if the parent folder is already the correct perms. You could alter this to include a deeper/problem file/directory, or with a find command similar to this
execute "chown-data-www" do
command "chown -R www-data:www-data /var/www/myfoler"
user "root"
action :run
not_if '[ $(stat -c %U /var/www/myfolder) = "www-data" ]'
end
Edit: fix to reflect comment below