2016-01-08 75 views
1

我想包括我的abc-cookbook,其中有一個ruby服務安裝在另一個食譜(稱爲xyz-cookbook)的metadata.rb中,我必須啓動它。 但是在部署中opswork實例我的設置是有錯誤,無法爲:無法添加cookbook依賴metadata.rb廚師

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:[email protected]/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-菜譜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' 

我在想什麼和什麼是錯誤實際上..

+0

您的自定義食譜中是否包含「abc-cookbook」和「xyz-cookbook」?你是否在堆棧中使用Berkshelf,如果不是,請仔細檢查它是否被禁用,它看起來像Stack認爲它已啓用。如果已啓用,請發佈您的Berksfile文件,並且您的自定義食譜文件路徑的外觀如何 – midN

回答

1

我沒有解決這個通過添加依賴我的根Berksfile,我錯過了,即使我包括我的食譜在另一個自定義食譜。 幫我:

重要

不要通過在您 Berksfile元數據線和metadata.rb聲明食譜依賴性聲明食譜。爲使 正常工作,兩個文件必須位於同一目錄中。使用AWS OpsWorks的 時,Berksfile必須位於存儲庫的根目錄 目錄中,但metadata.rb文件必須位於其各自的烹飪手冊 目錄中。您應該明確聲明Berksfile中的外部菜譜