[chef] Re: Recipe sequence question


Chronological Thread 
  • From: Adam Jacob < >
  • To:
  • Subject: [chef] Re: Recipe sequence question
  • Date: Thu, 25 Aug 2011 00:30:10 -0500

What creates /opt/tomcat/conf?

Adam

On Wed, Aug 24, 2011 at 7:00 PM,  
< >
 wrote:
> Hello,
>
> I have this recipe which installs tomcat, it fails the first time but works 
> the
> second time :)
>
> First time it fails because it can't create "/opt/tomcat/conf/server.xml,
> because /opt/tomcat doesn't exist yet, my question is why template is 
> getting
> executed before 'install-tomcat ? and why it works fine the second time
>
> bash "install-java" do
>  code "(cd /usr/local/src/; sh jdk-6u23-linux-x64.bin;mv jdk1.6.0_23/
> /opt/java)"
>  not_if "test -d /opt/java"
> end
> bash "install-tomcat" do
>  code "(cd /usr/local/src/; tar -xzvf apache-tomcat-6.0.32.tar.gz ;mv
> apache-tomcat-6.0.32  /opt/tomcat; chown -R tomcat:tomcat /opt/tomcat)"
>  not_if "test -d /opt/tomcat"
> end
> template "/opt/tomcat/conf/server.xml" do
>  source "server.xml.erb"
>  owner "tomcat"
>  group "tomcat"
>  mode "0644"
> end
>
>
>
> 184-106-136-38.static.cloud-ips.com Done.
> 184-106-136-38.static.cloud-ips.com [Tue, 23 Aug 2011 20:24:06 +0000] INFO:
> bash[install-java] ran successfully
> 184-106-136-38.static.cloud-ips.com [Tue, 23 Aug 2011 20:24:06 +0000] INFO:
> Processing bash[install-tomcat] action run (tomcat::default line 44)
> 184-106-136-38.static.cloud-ips.com [Tue, 23 Aug 2011 20:24:06 +0000] INFO:
> Processing template[/opt/tomcat/conf/server.xml] action create 
> (tomcat::default
> line 48)
> 184-106-136-38.static.cloud-ips.com [Tue, 23 Aug 2011 20:24:06 +0000] INFO:
> template[/opt/tomcat/conf/server.xml] owner changed to 500
> 184-106-136-38.static.cloud-ips.com [Tue, 23 Aug 2011 20:24:06 +0000] INFO:
> template[/opt/tomcat/conf/server.xml] owner changed to 500
> 184-106-136-38.static.cloud-ips.com [Tue, 23 Aug 2011 20:24:06 +0000] INFO:
> template[/opt/tomcat/conf/server.xml] mode changed to 644
> 184-106-136-38.static.cloud-ips.com [Tue, 23 Aug 2011 20:24:06 +0000] ERROR:
> template[/opt/tomcat/conf/server.xml] (tomcat::default line 48) has had an
> error
> 184-106-136-38.static.cloud-ips.com [Tue, 23 Aug 2011 20:24:06 +0000] ERROR:
> template[/opt/tomcat/conf/server.xml]
> (/var/chef/cache/cookbooks/tomcat/recipes/default.rb:48:in `from_file') had 
> an
> error:
> 184-106-136-38.static.cloud-ips.com template[/opt/tomcat/conf/server.xml]
> (tomcat::default line 48) had an error: No such file or directory -
> (/tmp/chef-rendered-template20110823-1316-1fq04or, 
> /opt/tomcat/conf/server.xml)
> 184-106-136-38.static.cloud-ips.com /usr/lib/ruby/1.9.1/fileutils.rb:515:in
> `rename'
> 184-106-136-38.static.cloud-ips.com /usr/lib/ruby/1.9.1/fileutils.rb:515:in
> `block in mv'
> 184-106-136-38.static.cloud-ips.com /usr/lib/ruby/1.9.1/fileutils.rb:1423:in
> `block in fu_each_src_dest'
> 184-106-136-38.static.cloud-ips.com /usr/lib/ruby/1.9.1/fileutils.rb:1439:in
> `fu_each_src_dest0'
> 184-106-136-38.static.cloud-ips.com /usr/lib/ruby/1.9.1/fileutils.rb:1421:in
> `fu_each_src_dest'
> 184-106-136-38.static.cloud-ips.com /usr/lib/ruby/1.9.1/fileutils.rb:504:in
> `mv'
> 184-106-136-38.static.cloud-ips.com
> /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/provider/template.rb:47:in
> `block in action_create'
> 184-106-136-38.static.cloud-ips.com
> /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/mixin/template.rb:48:in
> `block in render_template'
> 184-106-136-38.static.cloud-ips.com /usr/lib/ruby/1.9.1/tempfile.rb:320:in
> `open'
> 184-106-136-38.static.cloud-ips.com
> /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/mixin/template.rb:45:in
> `render_template'
> 184-106-136-38.static.cloud-ips.com
> /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/provider/template.rb:99:in
> `render_with_context'
> 184-106-136-38.static.cloud-ips.com
> /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/provider/template.rb:39:in
> `action_create'
> 184-106-136-38.static.cloud-ips.com
> /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/resource.rb:437:in
> `run_action'
> 184-106-136-38.static.cloud-ips.com
> /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/runner.rb:45:in 
> `run_action'
> 184-106-136-38.static.cloud-ips.com
> /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/runner.rb:81:in `block (2
> levels) in converge'
> 184-106-136-38.static.cloud-ips.com
> /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/runner.rb:81:in `each'
> 184-106-136-38.static.cloud-ips.com
> /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/runner.rb:81:in `block in
> converge'
> 184-106-136-38.static.cloud-ips.com
> /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/resource_collection.rb:94:in
> `block in execute_each_resource'
> 184-106-136-38.static.cloud-ips.com
> /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/resource_collection/stepable_iterator.rb:116:in
> `call'
> 184-106-136-38.static.cloud-ips.com
> /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/resource_collection/stepable_iterator.rb:116:in
> `call_iterator_block'
> 184-106-136-38.static.cloud-ips.com
> /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/resource
> 184-106-136-38.static.cloud-ips.com _collection/stepable_iterator.rb:85:in
> `step'
> 184-106-136-38.static.cloud-ips.com
> /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/resource_collection/stepable_iterator.rb:104:in
> `iterate'
> 184-106-136-38.static.cloud-ips.com
> /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/resource_collection/stepable_iterator.rb:55:in
> `each_with_index'
> 184-106-136-38.static.cloud-ips.com
> /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/resource_collection.rb:92:in
> `execute_each_resource'
> 184-106-136-38.static.cloud-ips.com
> /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/runner.rb:76:in 
> `converge'
> 184-106-136-38.static.cloud-ips.com
> /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/client.rb:312:in 
> `converge'
> 184-106-136-38.static.cloud-ips.com
> /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/client.rb:160:in `run'
> 184-106-136-38.static.cloud-ips.com
> /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/application/client.rb:239:in
> `block in run_application'
> 184-106-136-38.static.cloud-ips.com
> /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/application/client.rb:229:in
> `loop'
> 184-106-136-38.static.cloud-ips.com
> /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/application/client.rb:229:in
> `run_application'
> 184-106-136-38.static.cloud-ips.com
> /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/application.rb:67:in 
> `run'
> 184-106-136-38.static.cloud-ips.com
> /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/bin/chef-client:26:in `<top
> (required)>'
> 184-106-136-38.static.cloud-ips.com /usr/bin/chef-client:19:in `load'
> 184-106-136-38.static.cloud-ips.com /usr/bin/chef-client:19:in `<main>'
> 184-106-136-38.static.cloud-ips.com [Tue, 23 Aug 2011 20:24:06 +0000] ERROR:
> Running exception handlers
> 184-106-136-38.static.cloud-ips.com [Tue, 23 Aug 2011 20:24:06 +0000] FATAL:
> Saving node information to /var/chef/cache/failed-run-data.json
> 184-106-136-38.static.cloud-ips.com [Tue, 23 Aug 2011 20:24:06 +0000] ERROR:
> Exception handlers complete
> 184-106-136-38.static.cloud-ips.com [Tue, 23 Aug 2011 20:24:06 +0000] FATAL:
> Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
> 184-106-136-38.static.cloud-ips.com [Tue, 23 Aug 2011 20:24:06 +0000] FATAL:
> Errno::ENOENT: template[/opt/tomcat/conf/server.xml] (tomcat::default line 
> 48)
> had an error: No such file or directory -
> (/tmp/chef-rendered-template20110823-1316-1fq04or, 
> /opt/tomcat/conf/server.xml)
>



-- 
Opscode, Inc.
Adam Jacob, Chief Product Officer
T: (206) 619-7151 E: 




Archive powered by MHonArc 2.6.16.

§