Open jc1arke opened 9 years ago
I am also facing this error when following through the simple php tutorial.
Hi All,
This is an issue if you are using Berksfile in OpsWorks and the Berksfile has dependencies on apache2 cookbook pulled from super market.
ex:: if your Berksfile has a dependency like below::
source "https://api.berkshelf.com"
cookbook 'mongodb' cookbook 'mod_security'
Here, if you look at mod_security dependencies here:: https://supermarket.chef.io/cookbooks/mod_security#dependencies
It depends on
apache2 >= 0.0.0 build-essential >= 0.0.0
You see apache2 there, and OpsWorks also has cookbook with the same name, so the problem is you are overriding the OpsWorks cookbook with apache2 cookbook from supermarket and its causing the issue.
Solution::
1. avoid dependencies which installs conflicting cookbooks with OpsWorks.
@saidababuchanda thanks for the feedback on this. I agree, one should have a look at the dependencies of 3rd party cookbooks/recipes, but even so one should follow a strict rule in development that a object is not always as you expect it to be. With the AWS OpsWorks recipe, with no 3rd party recipes, it still has the issue where it fails on <% @environment.each do |key, value| %>
because @environment
is actually nil, thus it fails with each method not found for NilClass
. I tested this on a Chef Solo instance, separate from the OpsWorks stacks.
@jc1arke can you please give the entire sack trace of the issue?sorrry if I have misread your issue.
@saidababuchanda will post it once I am back on office on Monday, but will see if I can't replicate it over the weekend
@jc1arke sure , have a good one..
Hey there
Since last night, I have been issues on OpsWorks where when I try to deploy a new server or deploy one of our apps, we constantly get the error message below:
Digging around, I found that is due to L41 in mod_php5_apache2/templates/default/web_app.conf.erb
The gist is, it needs to change to cater for when @environment is not set or empty, not just work on the assumption it is there and has values. It's nil, so the each will fail.
This was mentioned on a previous issue (https://github.com/aws/opsworks-cookbooks/issues/228), but I don't think this has been resolved as yet. See https://github.com/aws/opsworks-cookbooks/blob/release-chef-11.10/mod_php5_apache2/templates/default/web_app.conf.erb, it's still there and unpatched.