4

我有一个使用 Opscode '数据库' 食谱的 Chef 自定义食谱。我在 Opsworks 堆栈中使用 Chef 11.10 和 Berkshelf 3.1.3,并在 Berksfile 中指定了“数据库”说明书。它正确地拉下依赖关系,我可以在日志中看到这一点。运行安装程序时,出现几个错误;一个关于找不到文件(并且路径确实不存在),另一个是 412,关于未满足“mysql”的依赖前提条件。

我不知道足够多的厨师知道第一个错误是否会导致第二次失败,但可以肯定的是,所需的 mysql 食谱版本似乎得到满足。有没有人知道的任何已知问题?这是设置命令失败的输出日志:

[2014-09-29T07:32:17+00:00] INFO: Starting chef-zero on port 8889 with repository at repository at /opt/aws/opsworks/current
One version per cookbook
data_bags at /var/lib/aws/opsworks/data/data_bags
nodes at /var/lib/aws/opsworks/data/nodes

[2014-09-29T07:32:18+00:00] INFO: Forking chef instance to converge...
[2014-09-29T07:32:18+00:00] INFO: *** Chef 11.10.4 ***
[2014-09-29T07:32:18+00:00] INFO: Chef-client pid: 2695
[2014-09-29T07:32:19+00:00] INFO: Setting the run_list to ["opsworks_custom_cookbooks::load", "opsworks_custom_cookbooks::execute"] from JSON
[2014-09-29T07:32:19+00:00] WARN: Run List override has been provided.
[2014-09-29T07:32:19+00:00] WARN: Original Run List: [recipe[opsworks_custom_cookbooks::load], recipe[opsworks_custom_cookbooks::execute]]
[2014-09-29T07:32:19+00:00] WARN: Overridden Run List: [recipe[opsworks_custom_cookbooks::load], recipe[opsworks_custom_cookbooks::execute]]
[2014-09-29T07:32:19+00:00] INFO: Run List is [recipe[opsworks_custom_cookbooks::load], recipe[opsworks_custom_cookbooks::execute]]
[2014-09-29T07:32:19+00:00] INFO: Run List expands to [opsworks_custom_cookbooks::load, opsworks_custom_cookbooks::execute]
[2014-09-29T07:32:19+00:00] INFO: Starting Chef Run for www-prod-migration-3.localdomain
[2014-09-29T07:32:19+00:00] INFO: Running start handlers
[2014-09-29T07:32:19+00:00] INFO: Start handlers complete.
[2014-09-29T07:32:19+00:00] INFO: HTTP Request Returned 404 Not Found: Object not found: /reports/nodes/www-prod-migration-3.localdomain/runs
[2014-09-29T07:32:34+00:00] INFO: Loading cookbooks [apache2, dependencies, deploy, gem_support, mod_php5_apache2, mysql, nginx, opsworks_agent_monit, opsworks_aws_flow_ruby, opsworks_berkshelf, opsworks_bundler, opsworks_commons, opsworks_custom_cookbooks, opsworks_initial_setup, opsworks_java, opsworks_nodejs, opsworks_rubygems, packages, passenger_apache2, php, rails, ruby, scm_helper, ssh_users, unicorn]
[2014-09-29T07:32:36+00:00] INFO: Not needed with Chef 11.x (x >= 8) anymore.
[2014-09-29T07:32:36+00:00] INFO: Processing package[git] action install (opsworks_custom_cookbooks::checkout line 11)
[2014-09-29T07:32:38+00:00] INFO: Processing directory[/root/.ssh] action create (opsworks_custom_cookbooks::checkout line 8)
[2014-09-29T07:32:38+00:00] INFO: Processing file[/root/.ssh/config] action touch (opsworks_custom_cookbooks::checkout line 16)
[2014-09-29T07:32:38+00:00] INFO: file[/root/.ssh/config] updated atime and mtime to 2014-09-29 07:32:38 +0000
[2014-09-29T07:32:38+00:00] INFO: Processing execute[echo 'StrictHostKeyChecking no' > /root/.ssh/config] action run (opsworks_custom_cookbooks::checkout line 23)
[2014-09-29T07:32:38+00:00] INFO: Processing template[/root/.ssh/id_dsa] action create (opsworks_custom_cookbooks::checkout line 27)
[2014-09-29T07:32:38+00:00] INFO: Processing git[Download Custom Cookbooks] action checkout (opsworks_custom_cookbooks::checkout line 29)
[2014-09-29T07:32:38+00:00] INFO: Processing ruby_block[Move single cookbook contents into appropriate subdirectory] action run (opsworks_custom_cookbooks::checkout line 64)
[2014-09-29T07:32:38+00:00] INFO: Processing opsworks_berkshelf_runner[Install berkshelf cookbooks] action berks_install (opsworks_berkshelf::install line 54)
[2014-09-29T07:32:38+00:00] INFO: Processing directory[/opt/aws/opsworks/current/berkshelf-cookbooks] action delete (/var/lib/aws/opsworks/cache.stage1/cookbooks/opsworks_berkshelf/providers/runner.rb line 2)
[2014-09-29T07:32:38+00:00] INFO: directory[/opt/aws/opsworks/current/berkshelf-cookbooks] deleted /opt/aws/opsworks/current/berkshelf-cookbooks recursively
[2014-09-29T07:32:38+00:00] INFO: Processing ruby_block[Install the cookbooks specified in the Berksfile and their dependencies] action run (/var/lib/aws/opsworks/cache.stage1/cookbooks/opsworks_berkshelf/providers/runner.rb line 11)
[2014-09-29T07:32:39+00:00] INFO:
Resolving cookbook dependencies...
Using apt (2.6.0)
Using aws (2.4.0)
Using build-essential (2.0.6)
Using chef-sugar (2.3.0)
Using database (2.3.0) from https://github.com/opscode-cookbooks/database.git (at master)
Using mysql (5.5.3)
Using mysql-chef_gem (0.0.5)
Using openssl (2.0.0)
Using postgresql (3.4.6)
Using xfs (1.1.0)
Using yum (3.3.2)
Using yum-mysql-community (0.1.10)
Vendoring apt (2.6.0) to /opt/aws/opsworks/current/berkshelf-cookbooks/apt
Vendoring aws (2.4.0) to /opt/aws/opsworks/current/berkshelf-cookbooks/aws
Vendoring build-essential (2.0.6) to /opt/aws/opsworks/current/berkshelf-cookbooks/build-essential
Vendoring chef-sugar (2.3.0) to /opt/aws/opsworks/current/berkshelf-cookbooks/chef-sugar
Vendoring database (2.3.0) to /opt/aws/opsworks/current/berkshelf-cookbooks/database
Vendoring mysql (5.5.3) to /opt/aws/opsworks/current/berkshelf-cookbooks/mysql
Vendoring mysql-chef_gem (0.0.5) to /opt/aws/opsworks/current/berkshelf-cookbooks/mysql-chef_gem
Vendoring openssl (2.0.0) to /opt/aws/opsworks/current/berkshelf-cookbooks/openssl
Vendoring postgresql (3.4.6) to /opt/aws/opsworks/current/berkshelf-cookbooks/postgresql
Vendoring xfs (1.1.0) to /opt/aws/opsworks/current/berkshelf-cookbooks/xfs
Vendoring yum (3.3.2) to /opt/aws/opsworks/current/berkshelf-cookbooks/yum
Vendoring yum-mysql-community (0.1.10) to /opt/aws/opsworks/current/berkshelf-cookbooks/yum-mysql-community

[2014-09-29T07:32:39+00:00] INFO: ruby_block[Install the cookbooks specified in the Berksfile and their dependencies] called
[2014-09-29T07:32:39+00:00] INFO: Processing execute[ensure correct permissions of custom cookbooks] action run (opsworks_custom_cookbooks::checkout line 82)
[2014-09-29T07:32:39+00:00] INFO: execute[ensure correct permissions of custom cookbooks] ran successfully
[2014-09-29T07:32:39+00:00] INFO: Processing ruby_block[merge all cookbooks sources] action run (opsworks_custom_cookbooks::load line 12)
[2014-09-29T07:32:40+00:00] INFO: ruby_block[merge all cookbooks sources] called
[2014-09-29T07:32:40+00:00] WARN: Skipping final node save because override_runlist was given
[2014-09-29T07:32:40+00:00] INFO: Chef Run complete in 20.634821643 seconds
[2014-09-29T07:32:40+00:00] INFO: Running report handlers
[2014-09-29T07:32:40+00:00] INFO: Report handlers complete

---

[2014-09-29T07:32:42+00:00] INFO: Starting chef-zero on port 8889 with repository at repository at /opt/aws/opsworks/current
One version per cookbook
data_bags at /var/lib/aws/opsworks/data/data_bags
nodes at /var/lib/aws/opsworks/data/nodes

[2014-09-29T07:32:42+00:00] INFO: Forking chef instance to converge...
[2014-09-29T07:32:42+00:00] INFO: *** Chef 11.10.4 ***
[2014-09-29T07:32:42+00:00] INFO: Chef-client pid: 2868
[2014-09-29T07:32:44+00:00] INFO: Setting the run_list to ["opsworks_custom_cookbooks::load", "opsworks_custom_cookbooks::execute"] from JSON
[2014-09-29T07:32:44+00:00] WARN: Run List override has been provided.
[2014-09-29T07:32:44+00:00] WARN: Original Run List: [recipe[opsworks_custom_cookbooks::load], recipe[opsworks_custom_cookbooks::execute]]
[2014-09-29T07:32:44+00:00] WARN: Overridden Run List: [recipe[opsworks_initial_setup], recipe[ssh_host_keys], recipe[ssh_users], recipe[mysql::client], recipe[dependencies], recipe[ebs], recipe[opsworks_ganglia::client], recipe[opsworks_stack_state_sync], recipe[mycustom-setup::nginx], recipe[mycustom-setup::php], recipe[mycustom-setup::nfs], recipe[mycustom-setup::framework], recipe[mycustom-setup::timezone], recipe[mycustom-setup::logrotate], recipe[newrelic::default], recipe[newrelic::php-agent], recipe[database::mysql], recipe[deploy::default], recipe[mycustom-deploy::repository], recipe[mycustom-deploy::nginx-site], recipe[mycustom-deploy::php-site], recipe[test_suite], recipe[opsworks_cleanup]]
[2014-09-29T07:32:44+00:00] INFO: Run List is [recipe[opsworks_initial_setup], recipe[ssh_host_keys], recipe[ssh_users], recipe[mysql::client], recipe[dependencies], recipe[ebs], recipe[opsworks_ganglia::client], recipe[opsworks_stack_state_sync], recipe[mycustom-setup::nginx], recipe[mycustom-setup::php], recipe[mycustom-setup::nfs], recipe[mycustom-setup::framework], recipe[mycustom-setup::timezone], recipe[mycustom-setup::logrotate], recipe[newrelic::default], recipe[newrelic::php-agent], recipe[database::mysql], recipe[deploy::default], recipe[mycustom-deploy::repository], recipe[mycustom-deploy::nginx-site], recipe[mycustom-deploy::php-site], recipe[test_suite], recipe[opsworks_cleanup]]
[2014-09-29T07:32:44+00:00] INFO: Run List expands to [opsworks_initial_setup, ssh_host_keys, ssh_users, mysql::client, dependencies, ebs, opsworks_ganglia::client, opsworks_stack_state_sync, mycustom-setup::nginx, mycustom-setup::php, mycustom-setup::nfs, mycustom-setup::framework, mycustom-setup::timezone, mycustom-setup::logrotate, newrelic::default, newrelic::php-agent, database::mysql, deploy::default, mycustom-deploy::repository, mycustom-deploy::nginx-site, mycustom-deploy::php-site, test_suite, opsworks_cleanup]
[2014-09-29T07:32:44+00:00] INFO: Starting Chef Run for www-prod-migration-3.localdomain
[2014-09-29T07:32:44+00:00] INFO: Running start handlers
[2014-09-29T07:32:44+00:00] INFO: Start handlers complete.
[2014-09-29T07:32:44+00:00] INFO: HTTP Request Returned 404 Not Found: Object not found: /reports/nodes/www-prod-migration-3.localdomain/runs
[2014-09-29T07:32:54+00:00] INFO: HTTP Request Returned 412 Precondition Failed: Could not satisfy version constraints for: mysql

================================================================================
Error Resolving Cookbooks for Run List:
================================================================================


Missing Cookbooks:
------------------
Could not satisfy version constraints for: mysql


Expanded Run List:
------------------
* opsworks_initial_setup
* ssh_host_keys
* ssh_users
* mysql::client
* dependencies
* ebs
* opsworks_ganglia::client
* opsworks_stack_state_sync
* mycustom-setup::nginx
* mycustom-setup::php
* mycustom-setup::nfs
* mycustom-setup::framework
* mycustom-setup::timezone
* mycustom-setup::logrotate
* newrelic::default
* newrelic::php-agent
* database::mysql
* deploy::default
* mycustom-deploy::repository
* mycustom-deploy::nginx-site
* mycustom-deploy::php-site
* test_suite
* opsworks_cleanup


[2014-09-29T07:32:55+00:00] ERROR: Running exception handlers
[2014-09-29T07:32:55+00:00] ERROR: Exception handlers complete
[2014-09-29T07:32:55+00:00] FATAL: Stacktrace dumped to /var/lib/aws/opsworks/cache.stage2/chef-stacktrace.out
[2014-09-29T07:32:55+00:00] ERROR: 412 "Precondition Failed"
[2014-09-29T07:32:55+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

这是 Berks 文件:

source  "https://supermarket.getchef.com"

cookbook "database" , "= 2.3.0" , git: "https://github.com/opscode-cookbooks/database.git"

这是食谱元数据中有趣的部分:

long_description  IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version           '0.1'
recipe            'mycustom-deploy::cron', 'Set up cron jobs'
recipe            'mycustom::default', 'Returns a fatal error'
recipe            'mycustom::nginx-site', 'configures Nginx for the new site'
recipe            'mycustom::p4ucron', '???'
recipe            'mycustom::php-site', 'Configures php for the new site'
recipe            'mycustom::service', 'Defines services with their allowed parameters'
recipe            'mycustom::repository', '???'

%w{ amazon }.each do |os|
  supports os
end


depends 'mycustom-setup'
depends 'database'

还有一些其他的自定义食谱,例如“mycustom-setup”,它是这个的依赖项。我想我应该仔细检查所有这些是否有冲突?

4

1 回答 1

1

检查您的 metadata.rb 与 Berksfile 食谱与依赖项。

我遇到了同样的问题,但在 AWS OpsWorks(为此目的实际上是 Chef Solo)中,主要问题的根源在于在 metadata.rb 中包含了一本食谱。删除解决了问题。这篇文章中涵盖/评论了该主题。

于 2016-08-09T22:52:03.383 回答