- From: Haselwanter Edmund <
>
- To:
- Subject: [chef] Re: Re: Re: Application Cookbook
- Date: Thu, 21 Apr 2011 13:39:21 +0200
Hi Seth
On 21.04.2011, at 13:27, Seth Chisamore wrote:
>
Edmund,
>
This is a know issue. The plan is to refactor the application cookbook's
>
recipes into a series of LWRPs which will allow multiple applications (of
>
the same type) to be deployed on the same server.
Do you have a draft of this work in progress?
>
This will also allow the deploy (and server daemon config) logic to be
>
leveraged from outside of the application cookbook.
I have refactored my heavy tomcat6 manager provider into a TomcatContext LWRP
which leverages the tomcat (opscode) cookbook and tomcat manager application.
It "works" but might need some polish. and would it would need access to the
node for defaults (
http://tickets.opscode.com/browse/CHEF-1946 which I don't
think is in the current release ?)
cu edi
>
>
Seth
>
>
--
>
Opscode, Inc.
>
Seth Chisamore, Senior Technical Evangelist
>
IRC, Skype, Twitter, Github: schisamo
>
>
On Thursday, April 21, 2011 at 5:10 AM, Haselwanter Edmund wrote:
>
>
> 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
>
>
>
--
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.