[chef] Re: Problems with Tomcat cookbook


Chronological Thread 
  • From: Stefán Freyr Stefánsson < >
  • To: " " < >
  • Subject: [chef] Re: Problems with Tomcat cookbook
  • Date: Fri, 23 Jan 2015 16:24:36 +0000
  • Accept-language: en-US
  • Authentication-results: lists.opscode.com; dkim=none (message not signed) header.d=none;lists.opscode.com; dmarc=none action=none header.from=nextcode.com;

I've created a minimal cookbook that sets the necessary attributes and calls the tomcat cookbook (the one we forked since the official one doesn't really work without some annoying hacks).


https://github.com/StFS/tomcat-cookbook-test


It includes a Gemfile and a Berksfile as well as a .lock files.

The test-kitchen config file (.kitchen.yml) defines two platforms (centos 7.0 and ubuntu 14.04) and a single suite that just runs the default recipe. The default recipe includes the apt cookbook (to update the packages on the ubuntu box) and then it includes the default tomcat recipe.


The attributes define a single custom instance and specify that the base instance should not be run.


Both platforms fail. The CentOS platform fails with the error message that I included in my previous mail (see below) and the Ubuntu platform fails with a similar message but not quite the same.

Here is the error message for the Ubuntu platform:

           ================================================================================
           Error executing action `create` on resource 'link[/var/lib/tomcat7-csa/webapps]'
           ================================================================================
           
           Errno::EISDIR
           -------------
           Is a directory @ unlink_internal - /var/lib/tomcat7-csa/webapps
           
           Resource Declaration:
           ---------------------
           # In /tmp/kitchen/cookbooks/tomcat/providers/instance.rb
           
            80:       link "#{new_resource.base}/#{name}" do
            81:         to new_resource.instance_variable_get("@#{attr}")
       
            83:     end
           
           Compiled Resource:
       
           # Declared in /tmp/kitchen/cookbooks/tomcat/providers/instance.rb:80:in `block (2 levels) in class_from_file'
           
           link("/var/lib/tomcat7-csa/webapps") do
             action :create
             retries 0
       
             default_guard_interpreter :default
             to "/var/lib/tomcat7-csa/webapps"
             link_type :symbolic"
             target_file "/var/lib/tomcat7-csa/webapps"
             declared_type :link
             cookbook_name :tomcat
           end

So it fails in a similar way (unable to link) but for a different directory (/var/lib/tomcat7-csa/webapps) than the CentOS run (which failed on the /usr/share/tomcat/bin​ directory).

Again, any help with this would be greatly appreciated.


-Stefan Freyr.



From: Stefán Freyr Stefánsson < >
Sent: Friday, January 23, 2015 1:31 PM
To:
Subject: [chef] Problems with Tomcat cookbook
 

Hi.


We're using the Tomcat cookbook which is stored in the opscode github account.


Well, actually we are using our own fork of that in which we've applied some of the numerous outstanding pull requests.


So this brings me to my question. It seems that the Opscode Tomcat cookbook (https://github.com/opscode-cookbooks/tomcat) isn't getting a lot of attention. It has 33 open pull requests, some of which make perfect sense (at least to me) but they don't even have a comment on them regarding whether they'll get merged or not.


There is still _some_ activity. A pull request was merged a month ago so it's not totally dead.


I also found an email on this list from last August about an organized hack session (http://lists.opscode.com/sympa/arc/chef/2014-08/msg00026.html) although it has no replies and I don't know what came out of that.


Right now we're working on setting up a non-standard instance of tomcat through this recipe and it's not really going great.


I've set the default["tomcat"]["run_base_instance"] attribute to false and I've added a block with our own Tomcat instance. However, the recipe fails when trying to configure Tomcat with the following error:

           ================================================================================
           Error executing action `create` on resource 'link[/usr/share/tomcat/bin]'
           ================================================================================
           
           Errno::EISDIR
           -------------
           Is a directory - /usr/share/tomcat/bin
           
           Resource Declaration:
           ---------------------
           # In /tmp/kitchen/cookbooks/tomcat/providers/instance.rb
           
            74:       link "#{new_resource.base}/#{dir}" do
            75:         to "#{node['tomcat']['base']}/#{dir}"
            76:       end
            77:     end
           
           Compiled Resource:
           ------------------
           # Declared in /tmp/kitchen/cookbooks/tomcat/providers/instance.rb:74:in `block (2 levels) in class_from_file'
           
           link("/usr/share/tomcat/bin") do
             provider Chef::Provider::Link
             action :create
             retries 0
             retry_delay 2
             guard_interpreter :default
             to "/usr/share/tomcat/bin"
             link_type :symbolic
             target_file "/usr/share/tomcat/bin"
             cookbook_name :tomcat
           end
           
​It looks like the cookbook is trying to create a link (/usr/share/tomcat/bin) which points to itself. Not only that, but the location already exists as a directory so even if it were pointing to something that made sense, it wouldn't be able to create it as it already exists.

I'll try to create a self-contained example demonstrating the problem using Test Kitchen, but in the meantime, if anybody knows what's going on here I'd appreciate any help with this.

-Stefan Freyr.





Archive powered by MHonArc 2.6.16.

§