Open axos88 opened 3 years ago
Correction: it happens without the run action as well. Workaround use sudo in the command...
Hi, I tried running the recipe with sudo privilege and with uri option in the apt_repository and the recipe is running fine. Also, execute recipe seems to works good in combination with apt_repository along with sudo privileges too. Hereby pasting the recipe below. Please let me know incase of any issues with the recipe
apt_repository 'postgresql' do uri 'apt.postgresql.org' action :add end execute 'as other user' do command 'echo foo' user 'foo' end
Description
results in:
due to the
at_exit
call here: https://github.com/chef/chef/blob/2900361916aa884ad8d54e98228aa3406964e8a3/lib/chef/resource/apt_repository.rb#L259The execute as other user forks, and when terminating seems to also want to delete that directory, but probably as the user specified, which does not have permission to do it.
Chef Version
I'm using chef 15.6.10, but the culprit line is present in chef 17 as well.
Platform Version
ubuntu 20.04