尝试在
下创建index.html时出现错误(请参阅下文) /root/chef-repo/cookbooks/apache
我该如何解决这个问题?
“在资源'cookbook_file上执行操作create
时出错[/var/www/html/index.html”
-----> Existing Chef installation detected
172.31.17.94 Starting the first Chef Client run...
172.31.17.94 Starting Chef Client, version 13.7.16
172.31.17.94 resolving cookbooks for run list: ["apache"]
172.31.17.94 Synchronizing Cookbooks:
172.31.17.94 - apache (0.1.0)
172.31.17.94 Installing Cookbook Gems:
172.31.17.94 Compiling Cookbooks...
172.31.17.94 Converging 4 resources
172.31.17.94 Recipe: apache::default
172.31.17.94 * yum_package[httpd] action install (up to date)
172.31.17.94 * service[httpd] action start (up to date)
172.31.17.94 * cookbook_file[/var/www/html/index.html] action create
172.31.17.94
172.31.17.94 ================================================================================
172.31.17.94 **Error executing action `create` on resource 'cookbook_file[/var/www/html/index.html]'
172.31.17.94** ================================================================================
172.31.17.94
172.31.17.94 Chef::Exceptions::FileNotFound
172.31.17.94 ------------------------------
172.31.17.94 Cookbook 'apache' (0.1.0) does not contain a file at any of these locations:
172.31.17.94 files/amazon-2017.09/index.html
172.31.17.94 files/amazon/index.html
172.31.17.94 files/default/index.html
172.31.17.94 files/index.html
172.31.17.94
172.31.17.94 Resource Declaration:
172.31.17.94 ---------------------
172.31.17.94 # In /var/chef/cache/cookbooks/apache/recipes/default.rb
172.31.17.94
172.31.17.94 14: cookbook_file '/var/www/html/index.html' do
172.31.17.94 15: source 'index.html'
172.31.17.94 16: owner 'root'
172.31.17.94 17: group 'root'
172.31.17.94 18: mode 0755
172.31.17.94 19: action :create
172.31.17.94 20: end
172.31.17.94 21:
172.31.17.94
172.31.17.94 Compiled Resource:
172.31.17.94 ------------------
172.31.17.94 # Declared in /var/chef/cache/cookbooks/apache/recipes/default.rb:14:in `from_file'
172.31.17.94
172.31.17.94 cookbook_file("/var/www/html/index.html") do
172.31.17.94 action [:create]
172.31.17.94 default_guard_interpreter :default
172.31.17.94 declared_type :cookbook_file
172.31.17.94 cookbook_name "apache"
172.31.17.94 recipe_name "default"
172.31.17.94 source "index.html"
172.31.17.94 owner "root"
172.31.17.94 group "root"
172.31.17.94 mode 493
172.31.17.94 path "/var/www/html/index.html"
172.31.17.94 verifications []
172.31.17.94 end
172.31.17.94
172.31.17.94 System Info:
172.31.17.94 ------------
172.31.17.94 chef_version=13.7.16
172.31.17.94 platform=amazon
172.31.17.94 platform_version=2017.09
172.31.17.94 ruby=ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-linux]
172.31.17.94 program_name=chef-client worker: ppid=26049;start=04:43:09;
172.31.17.94 executable=/opt/chef/bin/chef-client
172.31.17.94
172.31.17.94
172.31.17.94 Running handlers:
172.31.17.94 [2018-02-07T04:43:11+00:00] ERROR: Running exception handlers
172.31.17.94 Running handlers complete
172.31.17.94 [2018-02-07T04:43:11+00:00] ERROR: Exception handlers complete
172.31.17.94 Chef Client failed. 0 resources updated in 02 seconds
172.31.17.94 [2018-02-07T04:43:11+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
172.31.17.94 [2018-02-07T04:43:11+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
172.31.17.94 [2018-02-07T04:43:11+00:00] ERROR: cookbook_file[/var/www/html/index.html] (apache::default line 14) had an error: Chef::Exceptions::FileNotFound: Cookbook 'apache' (0.1.0) does not contain a file at any of these locations:
172.31.17.94 files/amazon-2017.09/index.html
172.31.17.94 files/amazon/index.html
172.31.17.94 files/default/index.html
172.31.17.94 files/index.html
172.31.17.94 [2018-02-07T04:43:11+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
答案 0 :(得分:0)
如错误所示,您正在请求source 'index.html'
,但该食谱中的index.html
目录下没有files/
个文件。也许您打算使用template
资源?