Hi,

I think that the cleanest way to go about this is to create a bash /
perl / python / whatever script that does the wget and watches the
exit status of it, cleaning it up if it was unsuccessful. Then you
would add this script to your puppet recipe as a "file" resource and
execute this script in the "exec" resource.

I do not think (somebody please correct me if I am wrong) that the
puppet language has something specific for what you want to do, so
your best bet would be using an external scripting language. It would
also be the cleanest and most powerful / flexible way.

The other choice would be writing your own resource using ruby and
adding it to puppet but depending on how much you actually use this it
could be too much overhead.

On Dec 18, 9:24 am, Patrick <kc7...@gmail.com> wrote:
> On Dec 17, 2010, at 9:45 PM, Erwin Bolwidt wrote:
>
> > Hi,
>
> > When I use an exec resource to create a file, a timeout may occur. As an 
> > example, I can run wget to get a file (not the most elegant solution but 
> > necessary sometimes), or run some other program that depends on the network 
> > to get some data that is necessary to create the file.
>
> > This timeout itself is fine, I could increase the timeout, but there are 
> > still cases where I would want puppet to stop after this timeout.
>
> > Problem is, what if the file was partially created? I use an exec resource 
> > with the creates attribute, so the next time puppet runs, it thinks that 
> > the exec resource has been satisfied, and it doesn't run the command again.
>
> What I do is have the second command's completion condition used as the 
> condition for the first exec.  Then I make sure the first exec will properly 
> handle a partially downloaded file.
>
> The one time this isn't easy, I embedded the whole thing in a shellscript 
> that moves the completed file to the right location at the end.
>
> I personally use zsync a bit since I can use the old file to speed up the 
> downloading when the file changes.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to