- From: Andrea Campi <
>
- To:
- Subject: [chef] Re: how to manage dependent resources?
- Date: Wed, 29 Feb 2012 16:22:39 +0100
- Authentication-results: mr.google.com; spf=pass (google.com: domain of
designates 10.52.88.103 as permitted sender)
; dkim=pass
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 one
>
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
The ivy provider should be able to retrieve the tomcat resource by
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.