- From: Adam Jacob <
>
- To:
- Subject: [chef] Re: Re: Re: Re: Re: Listing files in cookbook/files/default/
- Date: Tue, 27 Sep 2011 17:11:33 -0700
Yep. You can do this:
run_context.cookbook_collection["COOKBOOKNAME"].template_filenames
Which will result in an array of filenames. If you had
'default/foo.rb' and 'default/bar.rb', you'll get:
[ 'foo.rb', 'bar.rb' ]
Should give you what you want, with a bit of munging.
Best,
Adam
On Tue, Sep 27, 2011 at 3:15 PM, Jason J. W. Williams
<
>
wrote:
>
Thanks Adam. I'm trying to avoid hardcoding a list of templates into
>
my recipe, and instead introspect a sub-directory off templates/ to
>
auto-discover new files. Tried this with cookbook files instead of
>
templates, but those get cleaned out of the cache. Is there any
>
reliable way to introspect the authoritative contents of a templates/
>
subdirectory?
>
>
-J
>
>
On Tue, Sep 27, 2011 at 4:08 PM, Adam Jacob
>
<
>
>
wrote:
>
> When the template is called.
>
>
>
> Adam
>
>
>
> On Tue, Sep 27, 2011 at 1:59 PM, Jason J. W. Williams
>
> <
>
>
> wrote:
>
>> When do templates get cached? When the cookbook is loaded or when the
>
>> template is first called?
>
>>
>
>> -J
>
>>
>
>> On Sun, Sep 25, 2011 at 1:44 PM, Joshua Timberman
>
>> <
>
>
>> wrote:
>
>>> Hello,
>
>>>
>
>>> On Sep 24, 2011, at 17:06, "Jason J. W. Williams"
>
>>> <
>
>
>>> wrote:
>
>>>
>
>>> Is there a better way to dynamically list the contents of the
>
>>> <cookbook>/files/default/ directory from a recipe at runtime than
>
>>> inspecting that path in /var/chef/cache/cookbooks ?
>
>>>
>
>>> My concern is that the Chef sometimes removes files from the cache
>
>>> that are in the cookbook but it doesn't consider currently needed.
>
>>>
>
>>> Chef only downloads cookbook_file and template assets if it needs to
>
>>> render
>
>>> the target file. Otherwise they are cleaned up at the end of the chef
>
>>> run.
>
>>
>
>
>
>
>
>
>
> --
>
> Opscode, Inc.
>
> Adam Jacob, Chief Product Officer
>
> T: (206) 619-7151 E:
>
>
>
>
>
--
Opscode, Inc.
Adam Jacob, Chief Product Officer
T: (206) 619-7151 E:
- [chef] Listing files in cookbook/files/default/, Jason J. W. Williams, 09/24/2011
- [chef] Re: Listing files in cookbook/files/default/, Denis Barishev, 09/25/2011
- [chef] Re: Listing files in cookbook/files/default/, Joshua Timberman, 09/25/2011
- [chef] Re: Re: Listing files in cookbook/files/default/, Jason J. W. Williams, 09/25/2011
- [chef] Re: Re: Listing files in cookbook/files/default/, Jason J. W. Williams, 09/27/2011
- [chef] Re: Re: Re: Listing files in cookbook/files/default/, Adam Jacob, 09/27/2011
- [chef] Re: Re: Re: Re: Listing files in cookbook/files/default/, Jason J. W. Williams, 09/27/2011
- [chef] Re: Re: Re: Re: Re: Listing files in cookbook/files/default/, Adam Jacob, 09/27/2011
- [chef] How can I store the output of a bash command as a ruby variable?, Geoff Meakin Acid, 09/29/2011
- [chef] Re: How can I store the output of a bash command as a ruby variable?, Akzhan Abdulin, 09/29/2011
- [chef] Re: Re: How can I store the output of a bash command as a ruby variable?, Bryan McLellan, 09/29/2011
- [chef] Knifing multiple different chef servers, Geoff Meakin Acid, 09/29/2011
- [chef] Re: Knifing multiple different chef servers, Bryan Brandau, 09/29/2011
- [chef] Re: Re: Knifing multiple different chef servers, KC Braunschweig, 09/30/2011
- [chef] Re: Re: Re: Knifing multiple different chef servers, Joshua Timberman, 09/30/2011
- [chef] Re: How can I store the output of a bash command as a ruby variable?, Geoff Meakin Acid, 09/29/2011
Archive powered by MHonArc 2.6.16.