On 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 LWRPfile: 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 < "> > wrote:On Wed, Feb 29, 2012 at 9:53 AM, Bryan Berry < "> > 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.