无法在 metadata.rb 厨师中添加食谱依赖项

Unable to add cookbook dependency in metadata.rb chef

我正在尝试包含我的 abc-cookbook,它在我必须启动的另一本 cookbook(比如 xyz-cookbook)的 metadata.rb 中安装了 ruby 服务。 但是在 opswork 中部署实例时,我的设置失败并出现错误:

STDERR: Unable to satisfy constraints on package abc-cookbook, which does not exist, due to solution constraint (xyz-cookbook = 0.1.0). Solution constraints that may result in a constraint on abc-cookbook: [(xyz-cookbook = 0.1.0) -> (abc-cookbook >= 0.0.0)]
Missing artifacts: abac-cookbook
Demand that cannot be met: (xyz-cookbook = 0.1.0)
Unable to find a solution for demands: activemq (1.3.3), apacheds (0.1.0), apt (
---- End output of /opt/aws/opsworks/local/bin/berks vendor /opt/aws/opsworks/current/berkshelf-cookbooks ----
Ran /opt/aws/opsworks/local/bin/berks vendor /opt/aws/opsworks/current/berkshelf-cookbooks returned 106


Cookbook Trace:
---------------
/var/lib/aws/opsworks/cache.stage1/cookbooks/opsworks_commons/libraries/shellout.rb:9:in `shellout'
/var/lib/aws/opsworks/cache.stage1/cookbooks/opsworks_berkshelf/providers/runner.rb:13:in `block (3 levels) in class_from_file'


Resource Declaration:
---------------------
# In /var/lib/aws/opsworks/cache.stage1/cookbooks/opsworks_berkshelf/providers/runner.rb

11:   ruby_block 'Install the cookbooks specified in the Berksfile and their dependencies' do
12:     block do
13:       Chef::Log.info OpsWorks::ShellOut.shellout(
14:         berks_install_command,
15:         :cwd => ::File.dirname(OpsWorks::Berkshelf.berksfile),
16:         :environment  => {
17:           "BERKSHELF_PATH" => Opsworks::InstanceAgent::Environment.berkshelf_cache_path,
18:           "LC_ALL" => "en_US.UTF-8"
19:         }
20:       )
21: 
22:       ::FileUtils.rm_rf Opsworks::InstanceAgent::Environment.berkshelf_cache_path
23:     end
24: 
25:     only_if do
26:       OpsWorks::Berkshelf.berkshelf_installed? && OpsWorks::Berkshelf.berksfile_available?
27:     end
28:   end
29: end



Compiled Resource:
------------------
# Declared in /var/lib/aws/opsworks/cache.stage1/cookbooks/opsworks_berkshelf/providers/runner.rb:11:in `block in class_from_file'

ruby_block("Install the cookbooks specified in the Berksfile and their dependencies") do
action "run"
retries 0
retry_delay 2
block_name "Install the cookbooks specified in the Berksfile and their dependencies"
cookbook_name "opsworks_berkshelf"
block #<Proc:0x0055813e8bcb70@/var/lib/aws/opsworks/cache.stage1/cookbooks/opsworks_berkshelf/providers/runner.rb:12>
only_if { #code block }
end



[2016-01-08T12:33:45+00:00] INFO: Running queued delayed notifications before re-raising exception
[2016-01-08T12:33:45+00:00] ERROR: Running exception handlers
[2016-01-08T12:33:45+00:00] ERROR: Exception handlers complete
[2016-01-08T12:33:45+00:00] FATAL: Stacktrace dumped to /var/lib/aws/opsworks/cache.stage1/chef-stacktrace.out
[2016-01-08T12:33:45+00:00] ERROR: ruby_block[Install the cookbooks specified in the Berksfile and their dependencies] (/var/lib/aws/opsworks/cache.stage1/cookbooks/opsworks_berkshelf/providers/runner.rb line 11) had an error: Mixlib::ShellOut::ShellCommandFailed

我还在 xyz-cookbook metadata.rb 中添加了依赖项:

name             'xyz-cookbook'
maintainer       ''
maintainer_email ''
license          'All rights reserved'
description      'Installs/Configures create'
long_description 'Installs/Configures create'
version          '0.1.0'
depends          'abc-cookbook'

我错过了什么,实际上错误是什么..

我确实通过在我的根 Berksfile 中添加依赖项解决了这个问题,尽管我将我的食谱包含在另一本自定义食谱中,但我还是错过了。 这对我有帮助:

Important

Do not declare cookbooks by including a metadata line in your Berksfile and declaring the cookbook dependencies in metadata.rb. For this to work correctly, both files must be in the same directory. With AWS OpsWorks, the Berksfile must be in the repository's root directory, but metadata.rb files must be in their respective cookbook directories. You should instead explicitly declare external cookbooks in the Berksfile