[chef] Re: Re: Re: Re: Recipe application does not work because chef_envronment is not defined


Chronological Thread 
  • From: "Jesus M. Movilla" < >
  • To:
  • Subject: [chef] Re: Re: Re: Re: Recipe application does not work because chef_envronment is not defined
  • Date: Wed, 11 Apr 2012 11:49:34 +0200

Andrea,

The last problem has been solved. It was a problem of pointing at "lucid-0.10" repo instead of "lucid". Thaks a lot !

One question about application cookbok. Where is the war to be installed defined?.

I mean, I need to tell in some place the name of the war, the location....

According to recipe java_webapp.rb it seems that the corresponding databag is the right place but there is nothing related to war in java_app.json. 

Where and how can define the war attribute?

Now the recipe fails at this line:
       
 :war => "#{app['deploy_to']}/releases/#{app['war'][node.chef_environment]['checksum']}.war"


the backtrace

undefined method `[]' for nil:NilClass
/var/cache/chef/cookbooks/application/recipes/java_webapp.rb:104:in `from_file'
  /usr/lib/ruby/vendor_ruby/chef/mixin/recipe_definition_dsl_core.rb:69:in `instance_eval'
  /usr/lib/ruby/vendor_ruby/chef/mixin/recipe_definition_dsl_core.rb:69:in `method_missing'
  /var/cache/chef/cookbooks/application/recipes/java_webapp.rb:103:in `from_file'
  /usr/lib/ruby/vendor_ruby/chef/cookbook_version.rb:578:in `load_recipe'
  /usr/lib/ruby/vendor_ruby/chef/mixin/language_include_recipe.rb:40:in `include_recipe'
  /usr/lib/ruby/vendor_ruby/chef/mixin/language_include_recipe.rb:27:in `each'
  /usr/lib/ruby/vendor_ruby/chef/mixin/language_include_recipe.rb:27:in `include_recipe'
  /var/cache/chef/cookbooks/application/recipes/default.rb:31:in `from_file'
  /var/cache/chef/cookbooks/application/recipes/default.rb:28:in `each'
  /var/cache/chef/cookbooks/application/recipes/default.rb:28:in `from_file'
  /var/cache/chef/cookbooks/application/recipes/default.rb:25:in `each'
  /var/cache/chef/cookbooks/application/recipes/default.rb:25:in `from_file'
  /usr/lib/ruby/vendor_ruby/chef/search/query.rb:44:in `call'
  /usr/lib/ruby/vendor_ruby/chef/search/query.rb:44:in `search'
  /usr/lib/ruby/vendor_ruby/chef/search/query.rb:44:in `each'
  /usr/lib/ruby/vendor_ruby/chef/search/query.rb:44:in `search'
  /usr/lib/ruby/vendor_ruby/chef/mixin/language.rb:133:in `search'
  /var/cache/chef/cookbooks/application/recipes/default.rb:21:in `from_file'
  /usr/lib/ruby/vendor_ruby/chef/cookbook_version.rb:578:in `load_recipe'
  /usr/lib/ruby/vendor_ruby/chef/mixin/language_include_recipe.rb:40:in `include_recipe'
  /usr/lib/ruby/vendor_ruby/chef/mixin/language_include_recipe.rb:27:in `each'
  /usr/lib/ruby/vendor_ruby/chef/mixin/language_include_recipe.rb:27:in `include_recipe'
  /usr/lib/ruby/vendor_ruby/chef/run_context.rb:72:in `load'
  /usr/lib/ruby/vendor_ruby/chef/run_context.rb:69:in `each'
  /usr/lib/ruby/vendor_ruby/chef/run_context.rb:69:in `load'
  /usr/lib/ruby/vendor_ruby/chef/client.rb:195:in `setup_run_context'
  /usr/lib/ruby/vendor_ruby/chef/client.rb:159:in `run'
  /usr/lib/ruby/vendor_ruby/chef/application/client.rb:239:in `run_application'
  /usr/lib/ruby/vendor_ruby/chef/application/client.rb:229:in `loop'
  /usr/lib/ruby/vendor_ruby/chef/application/client.rb:229:in `run_application'
  /usr/lib/ruby/vendor_ruby/chef/application.rb:67:in `run'
  /usr/bin/chef-client:25
[Wed, 11 Apr 2012 11:39:20 +0200] FATAL: Stacktrace dumped to /var/cache/chef/chef-stacktrace.out
[Wed, 11 Apr 2012 11:39:20 +0200] DEBUG: NoMethodError: undefined method `[]' for nil:NilClass
/var/cache/chef/cookbooks/application/recipes/java_webapp.rb:104:in `from_file'
/usr/lib/ruby/vendor_ruby/chef/mixin/recipe_definition_dsl_core.rb:69:in `instance_eval'
/usr/lib/ruby/vendor_ruby/chef/mixin/recipe_definition_dsl_core.rb:69:in `method_missing'
/var/cache/chef/cookbooks/application/recipes/java_webapp.rb:103:in `from_file'
/usr/lib/ruby/vendor_ruby/chef/cookbook_version.rb:578:in `load_recipe'
/usr/lib/ruby/vendor_ruby/chef/mixin/language_include_recipe.rb:40:in `include_recipe'
/usr/lib/ruby/vendor_ruby/chef/mixin/language_include_recipe.rb:27:in `each'
/usr/lib/ruby/vendor_ruby/chef/mixin/language_include_recipe.rb:27:in `include_recipe'
/var/cache/chef/cookbooks/application/recipes/default.rb:31:in `from_file'
/var/cache/chef/cookbooks/application/recipes/default.rb:28:in `each'
/var/cache/chef/cookbooks/application/recipes/default.rb:28:in `from_file'
/var/cache/chef/cookbooks/application/recipes/default.rb:25:in `each'
/var/cache/chef/cookbooks/application/recipes/default.rb:25:in `from_file'
/usr/lib/ruby/vendor_ruby/chef/search/query.rb:44:in `call'
/usr/lib/ruby/vendor_ruby/chef/search/query.rb:44:in `search'
/usr/lib/ruby/vendor_ruby/chef/search/query.rb:44:in `each'
/usr/lib/ruby/vendor_ruby/chef/search/query.rb:44:in `search'
/usr/lib/ruby/vendor_ruby/chef/mixin/language.rb:133:in `search'
/var/cache/chef/cookbooks/application/recipes/default.rb:21:in `from_file'
/usr/lib/ruby/vendor_ruby/chef/cookbook_version.rb:578:in `load_recipe'
/usr/lib/ruby/vendor_ruby/chef/mixin/language_include_recipe.rb:40:in `include_recipe'
/usr/lib/ruby/vendor_ruby/chef/mixin/language_include_recipe.rb:27:in `each'
/usr/lib/ruby/vendor_ruby/chef/mixin/language_include_recipe.rb:27:in `include_recipe'
/usr/lib/ruby/vendor_ruby/chef/run_context.rb:72:in `load'
/usr/lib/ruby/vendor_ruby/chef/run_context.rb:69:in `each'
/usr/lib/ruby/vendor_ruby/chef/run_context.rb:69:in `load'
/usr/lib/ruby/vendor_ruby/chef/client.rb:195:in `setup_run_context'
/usr/lib/ruby/vendor_ruby/chef/client.rb:159:in `run'
/usr/lib/ruby/vendor_ruby/chef/application/client.rb:239:in `run_application'
/usr/lib/ruby/vendor_ruby/chef/application/client.rb:229:in `loop'
/usr/lib/ruby/vendor_ruby/chef/application/client.rb:229:in `run_application'
/usr/lib/ruby/vendor_ruby/chef/application.rb:67:in `run'
/usr/bin/chef-client:25
[Wed, 11 Apr 2012 11:39:20 +0200] FATAL: NoMethodError: undefined method `[]' for nil:NilClass


I guees beause app['war'] is not defined anywhere. Any hint?

Regards


On Wed, Apr 11, 2012 at 11:28 AM, Jesus M. Movilla < "> > wrote:
Ok

I have been a repo names "lucid-0.10". I guess this is the good one.

I will try again
Thanks!


On Wed, Apr 11, 2012 at 11:19 AM, Jesus M. Movilla < " target="_blank"> > wrote:
Hi Andrea

Thanks!

I have followed the instructions from this page to do it. The node is Ubuntu 10.10

Debian packaging; the service will be stopped and started for you.

sudo apt-get update
sudo apt-install chef

and this is what it hapens:

:~# sudo apt-get install chef
Leyendo lista de paquetes... Hecho
Creando árbol de dependencias
Leyendo la información de estado... Hecho
chef ya está en su versión más reciente.
0 actualizados, 0 se instalarán, 0 para eliminar y 92 no actualizados.

If I type chef-client, the version is not upgraded... (

[Wed, 11 Apr 2012 11:11:03 +0200] INFO: Starting Chef Run (Version 0.9.18)



Typing apt-get update, the following opscode repos appear in the full list of repos:

Obj http://apt.opscode.com lucid Release.gpg
Ign http://apt.opscode.com/ lucid/main Translation-en
Ign http://apt.opscode.com/ lucid/main Translation-es
Obj http://apt.opscode.com lucid Release
Ign http://apt.opscode.com lucid/main amd64 Packages
Obj http://apt.opscode.com lucid/main amd64 Packages


What is missing to upgrade chef-client to 0.10?

Regards


On Wed, Apr 11, 2012 at 10:47 AM, Andrea Campi < " target="_blank"> > wrote:
On Wed, Apr 11, 2012 at 10:15 AM, Jesus M. Movilla
< " target="_blank"> > wrote:
> Hi Andrea
>
> Regarding #1. Next I include the backtrace. Just to point out that
> "chef-client version" in the node shows "Starting Chef Run (Version
> 0.9.18)". However Chef server is 0.10.4

That's your problem then, you need to upgrade the chef gem on your
client. 0.9.x didn't know about environments.







Archive powered by MHonArc 2.6.16.

§