Reputation: 3
OK, I am new to chef and frankly a novice at programming and even worse come from a powershell/.NET background so take it easy! The idea of this execute block is to not run if the owner/group of the folder/file output is 'root wheel'
execute 'set_owner' do
command 'sudo chown -R root:wheel /applications/'
not_if { stat -c "%U %G" /mydir/ } = 'root wheel'
end
The idea is there, but the exact syntax isn't correct.
Upvotes: 0
Views: 371
Reputation: 54211
You wouldn't do this using an external command, I mean you could but it's a lot harder. Using plain Ruby code is easier:
not_if { ::File.stat('/mydir').uid == 0 && ::File.stat('/mydir').gid == 0 }
Upvotes: 2