I'm experiencing an error while trying to create a directory in C:\Program Files using Chef. I am running chef from a powershell environment as Administrator, so there shouldn't be any restrictions as to what actions I can perform.
recipes/default.rb
directory node['app']['unzip_path'] do
action :create
end
attributes/default.rb
default['app']['unzip_path'] = 'C:/Program files/App'
I'm getting this error:
[2013-06-25T01:51:13+00:00] FATAL: Chef::Exceptions::InsufficientPermissions: directory[C:/Program files/App] (app::agent line 15) had an error: Chef::Exceptions::InsufficientPermissions: Cannot create directory[C:/Program files/App] at C:/Program files/App due to insufficient permissions
Additional question: Does chef-solo run as the user running the powershell command or is it running as a special "chef" user
Following up on BrianJakovich's answer.
The mkdir_p
call should preserve idempotence in either case, but using a ruby block will probably be better since it will run at the convergence phase:
ruby_block "hack to mkdir on windows" do
block do
FileUtils.mkdir_p node['app']['unzip_path']
end
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With