Another option we be an additional attribute on your tomcat resource that takes in a list of key/value pairs of ivy 'packages' to install:tomcat "jira" douser node['jira']['user']dependencies 'mysql' => '5.1.18', 'foo' => '1.0.0'action :installendBasically the provider for 'tomcat' would use the ivy LWRP under the covers to install everything.Fun thing here is you could add support for other java dependency managers like maven relatively easy:tomcat "jira" douser node['jira']['user']dependencies 'commons-lang' => '2.0'dependency_manager :mavenaction :installend--Seth ChisamoreSoftware Development Engineer, Opscode, Inc.IRC, Skype, Twitter, Github: schisamoOn Wednesday, February 29, 2012 at 10:55 AM, Bryan Berry wrote:
that's a good idea Andrea but I really like the solution that ssd7 came up w/I generate the base inside the initialize method for my tomcat LWRP
file: tomcat/resources/default.rbdef initialize(*args)ssuper@action = ":install"catalina_parent = Pathname.new(node['tomcat']['home']).parent.to_s@base = "#{catalina_parent}/ "Chef::Log.debug("base_is ")@supports = {:report => true, :exception => true}endnow my recipe code looks like thist = tomcat "jira" douser node['jira']['user']action :installend# get mysql connectorivy "mysql-connector-java" dogroupId "mysql"version "5.1.18"dest "#{t.base}/lib"endmuch more elegantthanks a lot SSD!On Wed, Feb 29, 2012 at 4:22 PM, Andrea Campi < " target="_blank"> > wrote:
On Wed, Feb 29, 2012 at 9:53 AM, Bryan Berry < " target="_blank"> > wrote:
> I have an issue where I need to provide values generated dynamically by oneThe ivy provider should be able to retrieve the tomcat resource by
> resource to resources that follow it
>
> My tomcat lwrp generates a base directory for each new instance that is a
> readable attribute "base"
>
> Following resources will use that base attribute. In this example, the ivy
> resource should place a .jar file in the #{base}/lib directory
>
>
> include_recipe "ark"
>
> include_recipe "tomcat::base"
>
> include_recipe "ivy"
>
>
>
> t = tomcat "jira" do
>
> user node['jira']['user']
>
> action :install
>
> end
>
>
>
>
> # get mysql connector
>
> ivy "mysql-connector-java" do
>
> groupId "mysql"
>
> version "5.1.18"
>
> dest "#{t.base}/lib" # evaluates to "/lib"
>
>
> end
name, and then access any attribute.
So something like this:
ivy "mysql" do
groupId "mysql"
version "5.1.18"
base_resource :tomcat => "jira"
end
And then in the ivy provider do:
parent = resources(new_resource.base_resource)
parent.base
That's off the top of my head so YMMV
Andrea
Archive powered by MHonArc 2.6.16.