You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A better approach is to guard the resource and execute only if necessary, something like:
execute"fixup consul #{dirname}"docommand"chown -R #{consul_user}:#{consul_group}#{dirname}"only_if{Etc.getpwuid(File.stat(dirname).uid).name != "root"}end
This is untested example code, based on conversations in mailing list and jira ticket tracker from 6 years ago, and the current conditional only applies to the uid, not gid. That should be an easy-enough fix.
Another method would be to use Ruby to get all subdirectories and create resources for each one, but that could lead to unexpected resource creation, if dirname has 10k subdirs - unlikely but possible.
I'd be happy to submit a PR for this, if you're interested in this approach.
We commonly see an execute resource updated every chef run, despite nothing being changed:
Example from our env:
This was introduced in #141 - current source.
A better approach is to guard the resource and execute only if necessary, something like:
This is untested example code, based on conversations in mailing list and jira ticket tracker from 6 years ago, and the current conditional only applies to the uid, not gid. That should be an easy-enough fix.
Another method would be to use Ruby to get all subdirectories and create resources for each one, but that could lead to unexpected resource creation, if dirname has 10k subdirs - unlikely but possible.
I'd be happy to submit a PR for this, if you're interested in this approach.
/cc: @darron
The text was updated successfully, but these errors were encountered: