Shame wget doesn't do this for you. I'm sure there is a better tool to do 
.part files. Anyway, taking from kc7zzv's excellent idea ... something as 
simple as the following might do as a work-around:

exec {"wget-foo":
  command => "/usr/bin/wget 
http://mirror.ox.ac.uk/sites/mirror.centos.org/5.5/isos/x86_64/CentOS-5.5-x86_64-bin-8of8.iso
 
-c -O /tmp/centos.iso.part && mv /tmp/centos.iso.part /tmp/centos.iso",
  creates => "/tmp/centos.iso",
  timeout => 30,
}

This way you are leveraging the partial download not throwing it away. If it 
doesn't complete, it will continue where it left off from last run ... until 
the 'mv' is finally reached.

I'm not fond of this method generally because if the source changes puppet 
will do nothing. *shrug*. zsync/rsync are better answers I guess for huge 
files. I'd rather use the puppet file-server if the files are small enough.

ken.

On Saturday, December 18, 2010 8:24:27 AM UTC, kc7zzv 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