- From: Haselwanter Edmund <
>
- To:
- Subject: [chef] Re: Application Cookbook
- Date: Thu, 21 Apr 2011 11:10:14 +0200
On 21.04.2011, at 10:26, Haselwanter Edmund wrote:
>
Hi *,
>
>
I want to leverage the application cookbook for installing multiple
>
applications of the same type.
>
So I thought I re-use e.g. the application::java_webapp recipe. But this
>
obviously (or *not* so obviously)
>
does not work the way I thought it should.
>
>
Problem is:
>
>
search(:apps) do |app|
>
(app["server_roles"] & node.run_list.roles).each do |app_role|
>
>
app["type"][app_role].each do |thing|
>
node.run_state[:current_app] = app
>
include_recipe "application::#{thing}"
>
end
>
end
>
end
search(:apps) do |app|
(app["server_roles"] & node.roles).each do |app_role|
app["type"][app_role].each do |thing|
node.run_state[:current_app] = app
include_recipe "application::#{thing}"
end
app["type"]["#{app_role}_definitions"].each do |thing|
node.run_state[:current_app] = app
eval %Q{#{thing} "#{app['id']}-#{thing}"}
end
end
end
>
Does the loop correctly, BUT include_recipe will only work for the first
>
application of a type (which is by design)
>
>
[Thu, 21 Apr 2011 01:15:22 -0700] DEBUG: I am not loading
>
application::java_webapp, because I have already seen it.
>
[Thu, 21 Apr 2011 01:15:22 -0700] DEBUG: I am not loading
>
application::java_webapp, because I have already seen it.
>
[Thu, 21 Apr 2011 01:15:22 -0700] DEBUG: I am not loading
>
application::java_webapp, because I have already seen it.
>
>
So what to do instead?
>
>
1) Use a definition for DRY? But that is depricated, but somehow would feel
>
correct?
Hm. Where did I get that definitions are deprecated? Anyway. Putting the
stuff of reusable parts of the application cookbooks into
"resource groupings" aka definitions does work.
>
2) Use LWRP just to reuse the code from java_webapp.
>
3) Patch chef itself to allow a "force_include"
>
4) just copy the code to distinct recipes. But that's not DRY
>
>
any thoughts?
>
>
cu edi
>
--
>
DI Edmund Haselwanter,
>
,
>
http://edmund.haselwanter.com/
>
http://www.iteh.at | http://facebook.com/iTeh.solutions |
>
http://at.linkedin.com/in/haselwanteredmund
>
>
>
>
>
--
DI Edmund Haselwanter,
,
http://edmund.haselwanter.com/
http://www.iteh.at |
http://facebook.com/iTeh.solutions |
http://at.linkedin.com/in/haselwanteredmund
Archive powered by MHonArc 2.6.16.