【发布时间】:2016-01-25 23:35:12
【问题描述】:
下面是“主厨-客户”的错误信息:
它说食谱 apt is missing ,但是当我使用 knife cookbook list 检查厨师服务器中的食谱列表时,我看到了 apt 食谱。请帮我。我已经部署了 apache2 cookbook ,现在更改了节点中 chef-client 中的运行列表。
13: service 'apache2' do
14: supports :status => true
15: action [:enable, :start]
16: end
17:
18: template '/var/www/html/index.html' do
Running handlers:
[2016-01-25T07:40:17+00:00] ERROR: Running exception handlers
Running handlers complete
[2016-01-25T07:40:17+00:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 01 seconds
[2016-01-25T07:40:17+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2016-01-25T07:40:17+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-01-25T07:40:17+00:00] ERROR: Cookbook apt not found. If you're loading apt from another cookbook, make sure you configure the dependency in your metadata
[2016-01-25T07:40:17+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
更新:
我可以使用 Vagrant 在 Test Kitchen 中成功安装所有食谱,但我无法在 AWS EC2 中成功部署。
下面是另一个例子:
default_guard_interpreter :default
package_name "php-devel"
flush_cache {:before=>false, :after=>false}
declared_type :package
cookbook_name "php"
recipe_name "package"
end
Running handlers:
[2016-01-25T09:00:06-05:00] ERROR: Running exception
handlers Running handlers complete
[2016-01-25T09:00:06-05:00] ERROR:
Exception handlers complete Chef Client failed. 0 resources updated in
16 seconds
[2016-01-25T09:00:07-05:00] FATAL: Stacktrace dumped to
/var/chef/cache/chef-stacktrace.out
[2016-01-25T09:00:07-05:00] FATAL:
Please provide the contents of the stacktrace.out file if you file a
bug report
[2016-01-25T09:00:07-05:00] ERROR: yum_package[php-devel]
(php::package line 59) had an error: Chef::Exceptions::Package: No
candidate version available for php-devel
[2016-01-25T09:00:07-05:00]
FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited
unsuccessfully (exit code 1)
更新 2: 我已在 AWS EC2 Ubuntu 14.04 实例中成功安装了厨师食谱“Wordpress”。但是,在 Amazon Linux EC2 和 Redhat linux EC2 中失败了。那么这里可能是什么问题? 使用测试厨房,我可以成功部署在 CentOS 中!但无法在 AWS EC2 中安装 Redhat linux 和 Amazon Linux。
+ DocumentRoot /var/www/wordpress
+
+ <Directory /var/www/wordpress>
+ Options FollowSymLinks
+ AllowOverride FileInfo Options
+ Require all granted
+ </Directory>
+
+ <Directory />
+ Options FollowSymLinks
+ AllowOverride None
+ </Directory>
+
+ LogLevel info
+ ErrorLog /var/log/apache2/wordpress-error.log
+ CustomLog /var/log/apache2/wordpress-access.log combined
+
+ RewriteEngine On
+</VirtualHost>
- change mode from '' to '0644'
- change owner from '' to 'root'
- change group from '' to 'root'
* execute[a2ensite wordpress.conf] action run
- execute /usr/sbin/a2ensite wordpress.conf
Recipe: apache2::default
* service[apache2] action reload
- reload service service[apache2]
Running handlers:
Running handlers complete
Chef Client finished, 92/168 resources updated in 01 minutes 58 seconds
【问题讨论】:
-
您是否向厨师服务器上传或下载了 apt 食谱?
-
使用 berks ,我已经上传了所有依赖的说明书,使用“Berks install and berks upload”命令
-
我在 Redhat linux 中手动执行了“yum update”命令,然后重新运行“Chef-client”命令。但仍然出现同样的错误。