[lxc-devel] [PATCH] download: Have wget retry 3 times
Stéphane Graber
stgraber at ubuntu.com
Mon Jul 21 16:24:14 UTC 2014
On Mon, Jul 21, 2014 at 04:14:43PM +0000, Serge Hallyn wrote:
> Quoting Stéphane Graber (stgraber at ubuntu.com):
> > This forces wget to retry if it gets a network error.
> >
> > Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
>
> I thought we'd already done this.
I did a similar change for GPG a while back but so far we were relying
on wget's own auto-retry mechanism, which looking at the CI test results
I've been getting lately, doesn't seem entirely reliable...
>
> Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>
>
> > ---
> > templates/lxc-download.in | 14 ++++++++++++--
> > 1 file changed, 12 insertions(+), 2 deletions(-)
> >
> > diff --git a/templates/lxc-download.in b/templates/lxc-download.in
> > index c96bc31..5799de8 100644
> > --- a/templates/lxc-download.in
> > +++ b/templates/lxc-download.in
> > @@ -69,9 +69,19 @@ cleanup() {
> > fi
> > }
> >
> > +wget_wrapper() {
> > + for i in $(seq 3); do
> > + if wget $@; then
> > + return 0
> > + fi
> > + done
> > +
> > + return 1
> > +}
> > +
> > download_file() {
> > - if ! wget -T 30 -q https://${DOWNLOAD_SERVER}/$1 -O $2 >/dev/null 2>&1; then
> > - if ! wget -T 30 -q http://${DOWNLOAD_SERVER}/$1 -O $2 >/dev/null 2>&1; then
> > + if ! wget_wrapper -T 30 -q https://${DOWNLOAD_SERVER}/$1 -O $2 >/dev/null 2>&1; then
> > + if ! wget_wrapper -T 30 -q http://${DOWNLOAD_SERVER}/$1 -O $2 >/dev/null 2>&1; then
> > if [ "$3" = "noexit" ]; then
> > return 1
> > else
> > --
> > 1.9.1
> >
> > _______________________________________________
> > lxc-devel mailing list
> > lxc-devel at lists.linuxcontainers.org
> > http://lists.linuxcontainers.org/listinfo/lxc-devel
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel
--
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20140721/05301aee/attachment.sig>
More information about the lxc-devel
mailing list