[chef] Re: using a file in the recipe


Chronological Thread 
  • From: Michael Glenney < >
  • To: " " < >
  • Cc: " " < >
  • Subject: [chef] Re: using a file in the recipe
  • Date: Wed, 4 Jun 2014 05:22:04 -0700

I wouldn't do #1 just because you would have a reference to your cookbook name within a recipe in the cookbook.  Not a big deal but will fail if you rename the cookbook and forget to change that. 

#2 is the option I go with except I put all files like this (files needed for chef run but not for server standard ops) in {Chef::Config[:file_cache_path]} instead of /tmp.  

MG

Sent from my iPhone

On Jun 4, 2014, at 3:24 AM, Florian Hehlen < "> > wrote:

Hi,

 

I need to use a file that is delivered with a recipe. I do not need to copy it out of the cookbook. It contains some sql needed to initialize a DB.

 

Problem 1 – I can’t find a way to refer to a file inside a cookbook (ex: <cookbook_path>/files/default/myfile.sql). I end up with something like #{Chef::Config[:file_cache_path]}/cookbooks/my_cookbook/files/default/myfile.sql. It works but doesn’t feel right.

 

Problem 2 – I need to use the cookbook_file resource and copy the file to tmp otherwise the file is not available locally. Again, this feels like this is not what I should be doing.

 

Cheers,

Florian

 

From: Dennis Benzinger [ ">mailto: ]
Sent: 09 May 2014 17:58
To: ">
Subject: [chef] Re: who is the current user

 

Hello Florian,

you can use the following node attribute provided by Ohai:

node['current_user']


Cheers,
Dennis

On 08.05.2014 09:57, Florian Hehlen wrote:

Hi,

 

Is there a way to know from within a recipe the name of the user running the recipe?

 

Cheers,

Florian

 

LEGAL DISCLAIMER
This communication and any attached documents are strictly confidential and/or legally privileged and they may not be used or disclosed by someone who is not a named recipient. If you have received this electronic communication in error please notify the sender by replying to this electronic communication inserting the word "misdirected" as the subject and delete this communication from your system.

 

Dennis Benzinger
Platform Automation Engineer
Managed Services

Nymphenburger Straße 86
80636 München, Deutschland
www.hybris.com

Geschäftsführer:
Ariel Lüdi, Carsten Thoma, Moritz Zimmermann, Michael Zips

Amtsgericht:
München, HRB 124384



LEGAL DISCLAIMER
This communication and any attached documents are strictly confidential and/or legally privileged and they may not be used or disclosed by someone who is not a named recipient. If you have received this electronic communication in error please notify the sender by replying to this electronic communication inserting the word "misdirected" as the subject and delete this communication from your system.




Archive powered by MHonArc 2.6.16.

§