我正在编写一个创建文件的简单配方,如下所示:
file '/myfile' do
content 'Welcome to Technical Guftgu'
action :create
end
但是在主厨-客户端-zr上,我得到了以下错误:recipetest::recipe1 1:
[2022-03-08T10:54:16+00:00] ERROR: Running exception handlers
Running handlers complete
[2022-03-08T10:54:16+00:00] ERROR: Exception handlers complete
Chef Infra Client failed. 0 resources updated in 02 seconds
[2022-03-08T10:54:16+00:00] FATAL: Stacktrace dumped to /home/vagrant/.chef/local-mode-cache/cache/chef-stacktrace.out
[2022-03-08T10:54:16+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2022-03-08T10:54:16+00:00] FATAL: Errno::EACCES: file[/myfile] (test::recipe1 line 7) had an error: Errno::EACCES: Permission denied @ rb_sysopen - /myfile
发布于 2022-03-08 11:11:36
您的应用程序似乎无法访问文件/myfile
。
尝试这样做,以允许访问所有:sudo chmod a+rw /myfile
发布于 2022-03-08 16:33:04
Errno::EACCES的意思是“拒绝许可”
Errno类在运行时映射到系统调用错误。您可以在以下文件中(令人困惑地)发现:
特别是:
Errno.constants.include? :EACCES
#=> true
在大多数*nix系统上,Errno::EACCES映射到libc错误码,用于“拒绝权限”。具体地说:
Macro: int EACCES
"Permission denied." The file permissions do not allow the attempted operation.
这通常意味着#create操作没有读取、写入或遍历文件路径的权限,因此您需要更改实现(在原始文章中没有显示),以确保Ruby进程具有执行请求操作所需的文件或文件系统权限。
另请参阅
https://stackoverflow.com/questions/71393890
复制相似问题