On Thu, 2013-02-21 at 02:39 -0800, Andy Parker wrote:
> On Wed, Feb 20, 2013 at 9:18 AM, Adrien Thebo <[email protected]>
> wrote:
>         On Tue, Feb 19, 2013 at 11:10 PM, Andrew Parker
>         <[email protected]> wrote:
>         
>                 
>                 
>                 How about the provider just writes it out as a temp
>                 file when it needs it? If it is static, should never
>                 be edited, and is needed for the provider to execute
>                 correctly, then I can see just keeping it the code and
>                 writing it out when needed. Also, I believe it was not
>                 a very large file, so it won't bloat the code.
>         
>         
>         That's an approach that I hadn't considered. By having a
>         heredoc in the code and then writing out something with
>         Tempfile? 
> 
> 
> That is what I was thinking.
> 
> 
>   Tempfile.open("libuser.conf") do |conf_file|
>     conf_file.write(LIBUSER_CONF)
>     # do things that need the file
>   end
> 
> 
> Looking over the docs for Tempfile, though, using #open might not be
> the best thing since it doesn't unlink the file :(
> I'm willing to bet there is something in puppet for handling this
> properly, but I can't recall off the top of my head.

Why not use a proper file resource and a catalog/transaction to manage
those files? 

That way you can even control the file permissions. It's what we're
doing for some of the files puppet creates...

Of course if you want the file to be removed after it has been used (why
would you want that BTW, since you certainly will need it in a
subsequent run), then this won't properly work.

-- 
Brice Figureau
My Blog: http://www.masterzen.fr/

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-dev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to