- From: Andrea Campi <
>
- To:
- Subject: [chef] Re: Re: Re: how to manage dependent resources?
- Date: Wed, 29 Feb 2012 17:31:27 +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 4:55 PM, 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.rb
>
>
def initialize(*args)s
>
>
super
>
>
@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}
>
>
end
>
>
now my recipe code looks like this
>
>
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"
>
>
end
>
>
much more elegant
For such a simple, explicit dependency I agree, it's nice and elegant.
My approach probably works better in more complicated cases.
Andrea
Archive powered by MHonArc 2.6.16.