我正在使用this github repo来了解Berkshelf与Amazon Opsworks一起使用时的工作情况。我正在尝试的基本思想是如果我在我的 phpapp配方中提到apaches文件作为berksfile中的依赖项,那么它将自动管理 apache2 的依赖项,它本身就是一个依赖项对于phpapp。当我使用AWS opsworks尝试此操作时,我收到以下错误。
================================================================================
Error executing action `run` on resource 'execute[enable mod_proxy for apache-tomcat binding]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of /usr/sbin/a2enmod proxy ----
STDOUT:
STDERR: ERROR: Module proxy does not exist!
---- End output of /usr/sbin/a2enmod proxy ----
Ran /usr/sbin/a2enmod proxy returned 1
Resource Declaration:
---------------------
# In /var/lib/aws/opsworks/cache.stage2/cookbooks/opsworks_java/recipes/apache_tomcat_bind.rb
1: execute 'enable mod_proxy for apache-tomcat binding' do
2: command '/usr/sbin/a2enmod proxy'
3: not_if do
4: ::File.symlink?(::File.join(node['apache']['dir'], 'mods-enabled', 'proxy.load')) || node['opsworks_java']['tomcat']['apache_tomcat_bind_mod'] !~ /\Aproxy/
5: end
6: end
7:
Compiled Resource:
------------------
# Declared in /var/lib/aws/opsworks/cache.stage2/cookbooks/opsworks_java/recipes/apache_tomcat_bind.rb:1:in `from_file'
execute("enable mod_proxy for apache-tomcat binding") do
action "run"
retries 0
retry_delay 2
command "/usr/sbin/a2enmod proxy"
backup 5
returns 0
cookbook_name "opsworks_java"
recipe_name "apache_tomcat_bind"
not_if { #code block }
end
答案 0 :(得分:1)
将metadata
cookbook "apache2"
的{{1}}添加到您的Berks文件中,Berkshelf会将您的本地食谱添加到本地食谱列表中,以及metadata.rb
<的依赖性/ p>
来自berkshelf.com:
The metadata keyword is like saying gemspec in Bundler’s Gemfile. It says,
“There is a metadata.rb file within the same relative path of my Berksfile”.
This allows you to resolve a Cookbook’s dependencies that you are currently
working on just like you would resolve the dependencies of a Gem that
you are currently working on with Bundler.