[chef] RE: Append to a template within recipe


Chronological Thread 
  • From: "Nguyen, Dang" < >
  • To: " " < >
  • Subject: [chef] RE: Append to a template within recipe
  • Date: Thu, 16 Jul 2015 15:51:59 +0000
  • Accept-language: en-US
  • Authentication-results: lists.opscode.com; dkim=none (message not signed) header.d=none;
  • Blupr03mb277: X-MS-Exchange-Organization-RulesExecuted

You’d want to wrap your base cookbook in the app cookbook. Since you’ve already setup the dependency, your next step is to override the template source being referenced by the template resource. Julian Dunn wrote up a nice blog, entitled “Doing Wrapper Cookbooks Right” and addresses exactly how to specify a different template as the source from a wrapper cookbook.

 

Cheers,

Dang Nguyen

 

From: M G [mailto:
Sent: Thursday, July 16, 2015 8:41 AM
To:
Subject: [chef] Append to a template within recipe

 

Hi 

 

I have a base cookbook and a app cookbook which depends on base.

 

The base cookbook has a template - base_temp.conf.erb which gets used inside the app cookbook

 

app_cookbook/recipe/default.rb has include_recipe 'base'

 

Is there a way to append to the base template within app cookbook without modifying the template in the base cookbook as it is applicable only to this one app.

 

So can I have a app_temp.conf.erb which gets appended to the base_temp.conf in the recipe or maybe get the resource collection and append line by line to the base_temp.conf

 

I can get the template resource in the app recipe like so

 

run_context.resource_collection.lookup(

  "template[#{base_template}]")

 

But I dont know if any of the above is correct.

 

Any pointers would be appreciated?

 

Regards

 

mg

Attachment: smime.p7s
Description: S/MIME cryptographic signature




Archive powered by MHonArc 2.6.16.

§