Recipe application does not work because chef_envronment is not defined

Hi all,

I have installed chef 0.10.4 and I am testing the application cookbook.

The thing is that executing this cookbookit fails when the recipe
application::java_webapp.rb tries to get the value of the method
chef_environment of the Node Object (node.chef_environment). This is the error:

Re-raising exception: ArgumentError - Attribute chef_environment is not
defined!

I have checked the node with knife node edit command and I have seen that the
attribute chef_environment is set to “_default”


“chef_environment”: “_default”,
“run_list”: [
“recipe[application]”,
“role[my_app]”
]


So, I guess the value of the node.chef_environment should be “_default”, what
is the problem?

On the other hand, I have tried to modify the environment of this node via
knife by changing the value to “prooduction” (after creating this environment
in the chef server as it is said in the Usage section of this cookbook ) and It
happens two things:
1)The recipe still fails (same error)
2)The chef_environment in the node is changed back to “_default” after excution
of the recipe

Any hint?
Best Regards

On Wed, Apr 11, 2012 at 9:20 AM, jesus.movilla@altran.es wrote:

Hi all,

I have installed chef 0.10.4 and I am testing the application cookbook.

The thing is that executing this cookbookit fails when the recipe
application::java_webapp.rb tries to get the value of the method
chef_environment of the Node Object (node.chef_environment). This is the error:

Re-raising exception: ArgumentError - Attribute chef_environment is not
defined!

First of all, be aware that I'm currently on refactoring the
application cookbook, I will have a replacement ready in the next few
weeks.

Having said that, the current one shouldn't fail like this.
Can you show me where it fails? A backtrace would be most useful.

I have checked the node with knife node edit command and I have seen that the
attribute chef_environment is set to "_default"


"chef_environment": "_default",
"run_list": [
"recipe[application]",
"role[my_app]"
]


So, I guess the value of the node.chef_environment should be "_default", what
is the problem?

On the other hand, I have tried to modify the environment of this node via
knife by changing the value to "prooduction" (after creating this environment
in the chef server as it is said in the Usage section of this cookbook ) and It
happens two things:
1)The recipe still fails (same error)
2)The chef_environment in the node is changed back to "_default" after excution
of the recipe

Regarding #2, that can happen if you edit the node while a chef-client
run is happening on the client.
I assume you tried again, but try again :slight_smile:

Andrea

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

[Wed, 11 Apr 2012 10:05:26 +0200] DEBUG: Sending HTTP Request via GET to
10.95.107.48:4000/search/apps
[Wed, 11 Apr 2012 10:05:26 +0200] DEBUG: Loading Recipe
application::java_webapp via include_recipe
[Wed, 11 Apr 2012 10:05:26 +0200] DEBUG: Found recipe java_webapp in
cookbook application
[Wed, 11 Apr 2012 10:05:26 +0200] ERROR: Running exception handlers
[Wed, 11 Apr 2012 10:05:26 +0200] ERROR: Exception handlers complete
[Wed, 11 Apr 2012 10:05:26 +0200] DEBUG: Re-raising exception:
ArgumentError - Attribute chef_environment is not defined!
/usr/lib/ruby/1.8/chef/node/attribute.rb:428:in method_missing' /usr/lib/ruby/1.8/chef/node.rb:319:in send'
/usr/lib/ruby/1.8/chef/node.rb:319:in method_missing' /var/cache/chef/cookbooks/application/recipes/java_webapp.rb:28:in from_file'
/usr/lib/ruby/1.8/chef/cookbook_version.rb:473:in load_recipe' /usr/lib/ruby/1.8/chef/mixin/language_include_recipe.rb:40:in include_recipe'
/usr/lib/ruby/1.8/chef/mixin/language_include_recipe.rb:27:in each' /usr/lib/ruby/1.8/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/1.8/chef/search/query.rb:39:in call'
/usr/lib/ruby/1.8/chef/search/query.rb:39:in search' /usr/lib/ruby/1.8/chef/search/query.rb:39:in each'
/usr/lib/ruby/1.8/chef/search/query.rb:39:in search' /usr/lib/ruby/1.8/chef/mixin/language.rb:135:in search'
/var/cache/chef/cookbooks/application/recipes/default.rb:21:in from_file' /usr/lib/ruby/1.8/chef/cookbook_version.rb:473:in load_recipe'
/usr/lib/ruby/1.8/chef/mixin/language_include_recipe.rb:40:in
include_recipe' /usr/lib/ruby/1.8/chef/mixin/language_include_recipe.rb:27:in each'
/usr/lib/ruby/1.8/chef/mixin/language_include_recipe.rb:27:in
include_recipe' /usr/lib/ruby/1.8/chef/run_context.rb:94:in load'
/usr/lib/ruby/1.8/chef/run_context.rb:91:in each' /usr/lib/ruby/1.8/chef/run_context.rb:91:in load'
/usr/lib/ruby/1.8/chef/run_context.rb:55:in initialize' /usr/lib/ruby/1.8/chef/client.rb:166:in new'
/usr/lib/ruby/1.8/chef/client.rb:166:in run' /usr/lib/ruby/1.8/chef/application/client.rb:222:in run_application'
/usr/lib/ruby/1.8/chef/application/client.rb:212:in loop' /usr/lib/ruby/1.8/chef/application/client.rb:212:in run_application'
/usr/lib/ruby/1.8/chef/application.rb:62:in run' /usr/bin/chef-client:26 /usr/lib/ruby/1.8/chef/node/attribute.rb:428:in method_missing': Attribute
chef_environment is not defined! (ArgumentError)
from /usr/lib/ruby/1.8/chef/node.rb:319:in send' from /usr/lib/ruby/1.8/chef/node.rb:319:in method_missing'
from
/var/cache/chef/cookbooks/application/recipes/java_webapp.rb:28:in
from_file' from /usr/lib/ruby/1.8/chef/cookbook_version.rb:473:in load_recipe'
from /usr/lib/ruby/1.8/chef/mixin/language_include_recipe.rb:40:in
include_recipe' from /usr/lib/ruby/1.8/chef/mixin/language_include_recipe.rb:27:in each'
from /usr/lib/ruby/1.8/chef/mixin/language_include_recipe.rb:27:in
include_recipe' from /var/cache/chef/cookbooks/application/recipes/default.rb:31:in from_file'
from /var/cache/chef/cookbooks/application/recipes/default.rb:28:in
each' from /var/cache/chef/cookbooks/application/recipes/default.rb:28:in from_file'
from /var/cache/chef/cookbooks/application/recipes/default.rb:25:in
each' from /var/cache/chef/cookbooks/application/recipes/default.rb:25:in from_file'
from /usr/lib/ruby/1.8/chef/search/query.rb:39:in call' from /usr/lib/ruby/1.8/chef/search/query.rb:39:in search'
from /usr/lib/ruby/1.8/chef/search/query.rb:39:in each' from /usr/lib/ruby/1.8/chef/search/query.rb:39:in search'
from /usr/lib/ruby/1.8/chef/mixin/language.rb:135:in search' from /var/cache/chef/cookbooks/application/recipes/default.rb:21:in from_file'
from /usr/lib/ruby/1.8/chef/cookbook_version.rb:473:in load_recipe' from /usr/lib/ruby/1.8/chef/mixin/language_include_recipe.rb:40:in include_recipe'
from /usr/lib/ruby/1.8/chef/mixin/language_include_recipe.rb:27:in
each' from /usr/lib/ruby/1.8/chef/mixin/language_include_recipe.rb:27:in include_recipe'
from /usr/lib/ruby/1.8/chef/run_context.rb:94:in load' from /usr/lib/ruby/1.8/chef/run_context.rb:91:in each'
from /usr/lib/ruby/1.8/chef/run_context.rb:91:in load' from /usr/lib/ruby/1.8/chef/run_context.rb:55:in initialize'
from /usr/lib/ruby/1.8/chef/client.rb:166:in new' from /usr/lib/ruby/1.8/chef/client.rb:166:in run'
from /usr/lib/ruby/1.8/chef/application/client.rb:222:in
run_application' from /usr/lib/ruby/1.8/chef/application/client.rb:212:in loop'
from /usr/lib/ruby/1.8/chef/application/client.rb:212:in
run_application' from /usr/lib/ruby/1.8/chef/application.rb:62:in run'
from /usr/bin/chef-client:26

On Wed, Apr 11, 2012 at 9:50 AM, Andrea Campi
andrea.campi@zephirworks.comwrote:

On Wed, Apr 11, 2012 at 9:20 AM, jesus.movilla@altran.es wrote:

Hi all,

I have installed chef 0.10.4 and I am testing the application cookbook.

The thing is that executing this cookbookit fails when the recipe
application::java_webapp.rb tries to get the value of the method
chef_environment of the Node Object (node.chef_environment). This is the
error:

Re-raising exception: ArgumentError - Attribute chef_environment is not
defined!

First of all, be aware that I'm currently on refactoring the
application cookbook, I will have a replacement ready in the next few
weeks.

Having said that, the current one shouldn't fail like this.
Can you show me where it fails? A backtrace would be most useful.

I have checked the node with knife node edit command and I have seen
that the
attribute chef_environment is set to "_default"


"chef_environment": "_default",
"run_list": [
"recipe[application]",
"role[my_app]"
]


So, I guess the value of the node.chef_environment should be "_default",
what
is the problem?

On the other hand, I have tried to modify the environment of this node
via
knife by changing the value to "prooduction" (after creating this
environment
in the chef server as it is said in the Usage section of this cookbook )
and It
happens two things:
1)The recipe still fails (same error)
2)The chef_environment in the node is changed back to "_default" after
excution
of the recipe

Regarding #2, that can happen if you edit the node while a chef-client
run is happening on the client.
I assume you tried again, but try again :slight_smile:

This is the sequence of the commands that I execute:

1)knife node edit <node_name>
2)I go to the "chef_environment" attribute and I write "production"
instaead of "_default"
3)I save the changes (!wq with vi EDITOR)
4)I wait a minute and type again knife node edit <node_name> to check the
value is still "production" (it is)
5) I ecxecute "chef-client" in the node whose run_list includes the
cookbook application
6)The cookbook fails (the problem stated above)
7)I type again knife node edit <node_name> and the values is back to
"_default"

Andrea

Thanks a lot!

Jesus

On Wed, Apr 11, 2012 at 10:15 AM, Jesus M. Movilla
jesus.movilla@altran.es 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.

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:

root@sdcnode01:~# 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 <andrea.campi@zephirworks.com

wrote:

On Wed, Apr 11, 2012 at 10:15 AM, Jesus M. Movilla
jesus.movilla@altran.es 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.

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
jesus.movilla@altran.eswrote:

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:

root@sdcnode01:~# 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 <
andrea.campi@zephirworks.com> wrote:

On Wed, Apr 11, 2012 at 10:15 AM, Jesus M. Movilla
jesus.movilla@altran.es 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.

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
jesus.movilla@altran.eswrote:

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 <
jesus.movilla@altran.es> 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:

root@sdcnode01:~# 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 <
andrea.campi@zephirworks.com> wrote:

On Wed, Apr 11, 2012 at 10:15 AM, Jesus M. Movilla
jesus.movilla@altran.es 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.

On Wed, Apr 11, 2012 at 11:49 AM, Jesus M. Movilla
jesus.movilla@altran.eswrote:

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....

You should have an entry in your data bag like this:

"war": {
"_default": {
"source": "http://example.com/path/to/your/app.war",
"checksum": "SHA1 of the war file"
},
"production": {
"source": "http://example.com/path/to/your/app.war",
"checksum": "SHA1 of the war file"
}
}

Andrea,

We keep ong going on :slight_smile:

Now there is a problem when installing curl=7.19.5-1ubuntu2 which is
specified in the java_app.json in "packages". What is this packe for?, Can
it be removed from the data_bag?. The OS of the node is Ubuntu 10.10

Regards!

Generated at Wed Apr 11 14:27:24 +0200 2012
Chef::Exceptions::Exec: package[curl] (application::java_webapp line 32)
had an error: Chef::Exceptions::Exec: apt-get -q -y install
curl=7.19.5-1ubuntu2 returned 100, expected 0
/usr/lib/ruby/vendor_ruby/chef/mixin/command.rb:127:in
handle_command_failures' /usr/lib/ruby/vendor_ruby/chef/mixin/command.rb:74:in run_command'
/usr/lib/ruby/vendor_ruby/chef/mixin/command.rb:142:in
run_command_with_systems_locale' /usr/lib/ruby/vendor_ruby/chef/provider/package/apt.rb:92:in install_package'
/usr/lib/ruby/vendor_ruby/chef/provider/package.rb:60:in action_install' /usr/lib/ruby/vendor_ruby/chef/resource.rb:440:in send'
/usr/lib/ruby/vendor_ruby/chef/resource.rb:440:in run_action' /usr/lib/ruby/vendor_ruby/chef/runner.rb:45:in run_action'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in converge' /usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in each'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in converge' /usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:94:in execute_each_resource'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:in
call' /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:in call_iterator_block'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:85:in
step' /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:104:in iterate'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:55:in
each_with_index' /usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:92:in execute_each_resource'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:76:in converge' /usr/lib/ruby/vendor_ruby/chef/client.rb:312:in converge'
/usr/lib/ruby/vendor_ruby/chef/client.rb:160: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

On Wed, Apr 11, 2012 at 12:40 PM, Andrea Campi <andrea.campi@zephirworks.com

wrote:

On Wed, Apr 11, 2012 at 11:49 AM, Jesus M. Movilla <
jesus.movilla@altran.es> wrote:

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....

You should have an entry in your data bag like this:

"war": {
"_default": {
"source": "http://example.com/path/to/your/app.war",
"checksum": "SHA1 of the war file"
},
"production": {
"source": "http://example.com/path/to/your/app.war",
"checksum": "SHA1 of the war file"
}
}

On Wed, Apr 11, 2012 at 2:30 PM, Jesus M. Movilla
jesus.movilla@altran.es wrote:

Andrea,

We keep ong going on :slight_smile:

Now there is a problem when installing curl=7.19.5-1ubuntu2 which is
specified in the java_app.json in "packages". What is this packe for?, Can
it be removed from the data_bag?. The OS of the node is Ubuntu 10.10

That data bag is just an example; get rid of that package if you don't need it.
If OTOH your app needs any package installed, that's where you should
specify it—just make sure apt can find it and you should be good to go
:slight_smile:

Hi Adrea, all

Thanks for your previous reply.

I decided to remove the content of the attribute "packages" (as you said)
to avoid the above problem and I got finnally the cookbook executed without
errors but I can not see any tomcat installed. All that I can see is an
structure of directories that have been created in the directory specified
in "deploy_to" all of them empty except releases that contains the war
specified in "source" but with the name that has been specified in
"checksum"...

I guess something is wrong... What is supposed to do the java_webapp.rb and
the corresponding java_app.json recipe and data_bag?, Should not end this
story with a war deployed in a tomcat?

Thanks a lot!

On Wed, Apr 11, 2012 at 2:30 PM, Jesus M. Movilla
jesus.movilla@altran.eswrote:

Andrea,

We keep ong going on :slight_smile:

Now there is a problem when installing curl=7.19.5-1ubuntu2 which is
specified in the java_app.json in "packages". What is this packe for?, Can
it be removed from the data_bag?. The OS of the node is Ubuntu 10.10

Regards!

Generated at Wed Apr 11 14:27:24 +0200 2012
Chef::Exceptions::Exec: package[curl] (application::java_webapp line 32)
had an error: Chef::Exceptions::Exec: apt-get -q -y install
curl=7.19.5-1ubuntu2 returned 100, expected 0
/usr/lib/ruby/vendor_ruby/chef/mixin/command.rb:127:in
handle_command_failures' /usr/lib/ruby/vendor_ruby/chef/mixin/command.rb:74:in run_command'
/usr/lib/ruby/vendor_ruby/chef/mixin/command.rb:142:in
run_command_with_systems_locale' /usr/lib/ruby/vendor_ruby/chef/provider/package/apt.rb:92:in install_package'
/usr/lib/ruby/vendor_ruby/chef/provider/package.rb:60:in action_install' /usr/lib/ruby/vendor_ruby/chef/resource.rb:440:in send'
/usr/lib/ruby/vendor_ruby/chef/resource.rb:440:in run_action' /usr/lib/ruby/vendor_ruby/chef/runner.rb:45:in run_action'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in converge' /usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in each'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in converge' /usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:94:in execute_each_resource'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:in
call' /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:in call_iterator_block'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:85:in
step' /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:104:in iterate'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:55:in
each_with_index' /usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:92:in execute_each_resource'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:76:in converge' /usr/lib/ruby/vendor_ruby/chef/client.rb:312:in converge'
/usr/lib/ruby/vendor_ruby/chef/client.rb:160: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

On Wed, Apr 11, 2012 at 12:40 PM, Andrea Campi <
andrea.campi@zephirworks.com> wrote:

On Wed, Apr 11, 2012 at 11:49 AM, Jesus M. Movilla <
jesus.movilla@altran.es> wrote:

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....

You should have an entry in your data bag like this:

"war": {
"_default": {
"source": "http://example.com/path/to/your/app.war",
"checksum": "SHA1 of the war file"
},
"production": {
"source": "http://example.com/path/to/your/app.war",
"checksum": "SHA1 of the war file"
}
}

On Wed, Apr 11, 2012 at 3:19 PM, Jesus M. Movilla
jesus.movilla@altran.es wrote:

Hi Adrea, all

Thanks for your previous reply.

I decided to remove the content of the attribute "packages" (as you said) to
avoid the above problem and I got finnally the cookbook executed without
errors but I can not see any tomcat installed. All that I can see is an
structure of directories that have been created in the directory specified
in "deploy_to" all of them empty except releases that contains the war
specified in "source" but with the name that has been specified in
"checksum"...

I guess something is wrong... What is supposed to do the java_webapp.rb and
the corresponding java_app.json recipe and data_bag?, Should not end this
story with a war deployed in a tomcat?

Does your data bag contain tomcat too?

"type": {
"my_app": [ <— with your app name, of course
"java_webapp",
"tomcat"
]
},

If so, you should also have a ROOT.xml file in your Tomcat context
directory, and it should contain the name of your war file.

But since you say Tomcat was not installed, I supposed you don't. Try with that.

Andrea

Hi Andrea

You are completely right. It was missing "tomcat" cookbook in the type
attribute of the databag.

Everything worked fine excepto with the tomcat cookbook. The process of
starting tomcat gives back the following error.

[Thu, 12 Apr 2012 12:18:34 +0200] DEBUG: service[tomcat] runlevel 5, action
start, priority 92
[Thu, 12 Apr 2012 12:18:34 +0200] DEBUG: Executing /usr/sbin/invoke-rc.d
tomcat6 start
[Thu, 12 Apr 2012 12:18:39 +0200] DEBUG: ---- Begin output of
/usr/sbin/invoke-rc.d tomcat6 start ----
[Thu, 12 Apr 2012 12:18:39 +0200] DEBUG: STDOUT: * Starting Tomcat servlet
engine tomcat6
...fail!
[Thu, 12 Apr 2012 12:18:39 +0200] DEBUG: STDERR: invoke-rc.d: initscript
tomcat6, action "start" failed.
[Thu, 12 Apr 2012 12:18:39 +0200] DEBUG: ---- End output of
/usr/sbin/invoke-rc.d tomcat6 start ----
[Thu, 12 Apr 2012 12:18:39 +0200] DEBUG: Ran /usr/sbin/invoke-rc.d tomcat6
start returned 1
[Thu, 12 Apr 2012 12:18:39 +0200] ERROR: service[tomcat] (tomcat::default
line 42) has had an error
[Thu, 12 Apr 2012 12:18:39 +0200] ERROR: service[tomcat]
(/var/cache/chef/cookbooks/tomcat/recipes/default.rb:42:in `from_file') had
an error:
service[tomcat] (tomcat::default line 42) had an error:
Chef::Exceptions::Exec: /usr/sbin/invoke-rc.d tomcat6 start returned 1,
expected 0
---- Begin output of /usr/sbin/invoke-rc.d tomcat6 start ----
STDOUT: * Starting Tomcat servlet engine tomcat6
...fail!STDERR: invoke-rc.d: initscript tomcat6, action "start" failed.
---- End output of /usr/sbin/invoke-rc.d tomcat6 start ----

/usr/lib/ruby/vendor_ruby/chef/mixin/command.rb:127:in
handle_command_failures' /usr/lib/ruby/vendor_ruby/chef/mixin/command.rb:74:in run_command'
/usr/lib/ruby/vendor_ruby/chef/provider/service/init.rb:37:in
start_service' /usr/lib/ruby/vendor_ruby/chef/provider/service.rb:57:in action_start'
/usr/lib/ruby/vendor_ruby/chef/resource.rb:440:in send' /usr/lib/ruby/vendor_ruby/chef/resource.rb:440:in run_action'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:45:in run_action' /usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in converge'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in each' /usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in converge'
/usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:94:in
execute_each_resource' /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:in call'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:in
call_iterator_block' /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:85:in step'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:104:in
iterate' /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:55:in each_with_index'
/usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:92:in
execute_each_resource' /usr/lib/ruby/vendor_ruby/chef/runner.rb:76:in converge'
/usr/lib/ruby/vendor_ruby/chef/client.rb:312:in converge' /usr/lib/ruby/vendor_ruby/chef/client.rb:160: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
[Thu, 12 Apr 2012 12:18:39 +0200] ERROR: Running exception handlers
[Thu, 12 Apr 2012 12:18:39 +0200] FATAL: Saving node information to
/var/cache/chef/failed-run-data.json
[Thu, 12 Apr 2012 12:18:39 +0200] ERROR: Exception handlers complete
[Thu, 12 Apr 2012 12:18:39 +0200] DEBUG: Re-raising exception:
Chef::Exceptions::Exec - service[tomcat] (tomcat::default line 42) had an
error: Chef::Exceptions::Exec: /usr/sbin/invoke-rc.d tomcat6 start returned
1, expected 0
---- Begin output of /usr/sbin/invoke-rc.d tomcat6 start ----
STDOUT: * Starting Tomcat servlet engine tomcat6
...fail!STDERR: invoke-rc.d: initscript tomcat6, action "start" failed.
---- End output of /usr/sbin/invoke-rc.d tomcat6 start ----

/usr/lib/ruby/vendor_ruby/chef/mixin/command.rb:127:in
handle_command_failures' /usr/lib/ruby/vendor_ruby/chef/mixin/command.rb:74:in run_command'
/usr/lib/ruby/vendor_ruby/chef/provider/service/init.rb:37:in
start_service' /usr/lib/ruby/vendor_ruby/chef/provider/service.rb:57:in action_start'
/usr/lib/ruby/vendor_ruby/chef/resource.rb:440:in send' /usr/lib/ruby/vendor_ruby/chef/resource.rb:440:in run_action'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:45:in run_action' /usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in converge'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in each' /usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in converge'
/usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:94:in
`execute_each_resource'

/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:in
`call'

/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:in
`call_iterator_block'

/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:85:in
`step'

/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:104:in
`iterate'

/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:55:in
each_with_index' /usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:92:in execute_each_resource'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:76:in converge' /usr/lib/ruby/vendor_ruby/chef/client.rb:312:in converge'
/usr/lib/ruby/vendor_ruby/chef/client.rb:160: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
[Thu, 12 Apr 2012 12:18:39 +0200] FATAL: Stacktrace dumped to
/var/cache/chef/chef-stacktrace.out
[Thu, 12 Apr 2012 12:18:39 +0200] DEBUG: Chef::Exceptions::Exec:
service[tomcat] (tomcat::default line 42) had an error:
Chef::Exceptions::Exec: /usr/sbin/invoke-rc.d tomcat6 start returned 1,
expected 0
---- Begin output of /usr/sbin/invoke-rc.d tomcat6 start ----
STDOUT: * Starting Tomcat servlet engine tomcat6
...fail!STDERR: invoke-rc.d: initscript tomcat6, action "start" failed.
---- End output of /usr/sbin/invoke-rc.d tomcat6 start ----

/usr/lib/ruby/vendor_ruby/chef/mixin/command.rb:127:in
handle_command_failures' /usr/lib/ruby/vendor_ruby/chef/mixin/command.rb:74:in run_command'
/usr/lib/ruby/vendor_ruby/chef/provider/service/init.rb:37:in
start_service' /usr/lib/ruby/vendor_ruby/chef/provider/service.rb:57:in action_start'
/usr/lib/ruby/vendor_ruby/chef/resource.rb:440:in send' /usr/lib/ruby/vendor_ruby/chef/resource.rb:440:in run_action'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:45:in run_action' /usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in converge'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in each' /usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in converge'
/usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:94:in
execute_each_resource' /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:in call'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:in
call_iterator_block' /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:85:in step'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:104:in
iterate' /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:55:in each_with_index'
/usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:92:in
execute_each_resource' /usr/lib/ruby/vendor_ruby/chef/runner.rb:76:in converge'
/usr/lib/ruby/vendor_ruby/chef/client.rb:312:in converge' /usr/lib/ruby/vendor_ruby/chef/client.rb:160: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
[Thu, 12 Apr 2012 12:18:39 +0200] FATAL: Chef::Exceptions::Exec:
service[tomcat] (tomcat::default line 42) had an error:
Chef::Exceptions::Exec: /usr/sbin/invoke-rc.d tomcat6 start returned 1,
expected 0
---- Begin output of /usr/sbin/invoke-rc.d tomcat6 start ----
STDOUT: * Starting Tomcat servlet engine tomcat6
...fail!STDERR: invoke-rc.d: initscript tomcat6, action "start" failed.
---- End output of /usr/sbin/invoke-rc.d tomcat6 start ----

However, the tomcat is up and running and the war application can be
accessed at http://:8080/ since it is described in ROOT.xml

Should I start another issue with the tmcat cookbook or remain here?

Thanks a lot for your help!

On Wed, Apr 11, 2012 at 3:37 PM, Andrea Campi
andrea.campi@zephirworks.comwrote:

On Wed, Apr 11, 2012 at 3:19 PM, Jesus M. Movilla
jesus.movilla@altran.es wrote:

Hi Adrea, all

Thanks for your previous reply.

I decided to remove the content of the attribute "packages" (as you
said) to
avoid the above problem and I got finnally the cookbook executed without
errors but I can not see any tomcat installed. All that I can see is an
structure of directories that have been created in the directory
specified
in "deploy_to" all of them empty except releases that contains the war
specified in "source" but with the name that has been specified in
"checksum"...

I guess something is wrong... What is supposed to do the java_webapp.rb
and
the corresponding java_app.json recipe and data_bag?, Should not end this
story with a war deployed in a tomcat?

Does your data bag contain tomcat too?

"type": {
"my_app": [ <— with your app name, of course
"java_webapp",
"tomcat"
]
},

If so, you should also have a ROOT.xml file in your Tomcat context
directory, and it should contain the name of your war file.

But since you say Tomcat was not installed, I supposed you don't. Try with
that.

Andrea

On Thu, Apr 12, 2012 at 12:23 PM, Jesus M. Movilla
jesus.movilla@altran.es wrote:

Hi Andrea

You are completely right. It was missing "tomcat" cookbook in the type
attribute of the databag.

Everything worked fine excepto with the tomcat cookbook. The process of
starting tomcat gives back the following error.

[Thu, 12 Apr 2012 12:18:34 +0200] DEBUG: service[tomcat] runlevel 5, action
start, priority 92
[Thu, 12 Apr 2012 12:18:34 +0200] DEBUG: Executing /usr/sbin/invoke-rc.d
tomcat6 start
[Thu, 12 Apr 2012 12:18:39 +0200] DEBUG: ---- Begin output of
/usr/sbin/invoke-rc.d tomcat6 start ----
[Thu, 12 Apr 2012 12:18:39 +0200] DEBUG: STDOUT: * Starting Tomcat servlet
engine tomcat6
...fail!

What happens if you run /usr/sbin/invoke-rc.d tomcat6 start manually?

Chances are it will fail there too; on some platforms/distros that's
what happens when you start a service that is already started.
Does the service "tomcat" declaration has this for your platform:

supports :status => true

?

Try to at least see it running cleanly once: stop tomcat, remove the
war and its context, and do a chef-client run once; it should run
cleanly and start tomcat.
If it does, then as far as the application cookbook goes everything
should be good.

Sorry, hard to help you much further without getting into a lot of details.