- From: Haselwanter Edmund <
>
- To:
- Subject: [chef] Application Cookbook
- Date: Thu, 21 Apr 2011 10:26:40 +0200
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
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?
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
- [chef] Application Cookbook, Haselwanter Edmund, 04/21/2011
Archive powered by MHonArc 2.6.16.