[chef] Find top-level directories according to file specificity, stow installed directories


Chronological Thread 
  • From: Allan Wind < >
  • To:
  • Subject: [chef] Find top-level directories according to file specificity, stow installed directories
  • Date: Wed, 20 Oct 2010 17:36:18 -0400

I would like to create a recipe that installs the available top-level 
directories 
in files.  For example:

files/
        default/
                a/
                        ...
        redhat/
                b/
                        ...

on redhat it would mean calling remote_directory with 'a' and 
'b', otherwise just 'a'.  How do I find the directories in 
question?

I looked in node and only saw a full path in @file_filenames.  I 
guess I can deduce it from that given a cookbook and __FILE__.  
Is there a way to determine in a recipe which cookbook it belongs 
to?

dirs.each do |d|
        remote_directory File.join("/usr/local/stow", d)
                source d
        end
end

After installing these directories I want to run the command stow
to create synlinks from /usr/local/stow/$package to /usr/local.  
Is there a way to kick off that command only if remote_directory
actually installed something?  I noticed if I add a print 
statement in the below source it executes every time instead of
just when the directory updates.  If the answer here is a script
via notifies how do I pass data to the script (i.e. the directory 
to stow)?

 
/Allan
-- 
Allan Wind
Life Integrity, LLC
<http://lifeintegrity.com>




Archive powered by MHonArc 2.6.16.

§