[elbe-devel] [PATCH v4] soapclient/get_files: initialize retry variable

John Ogness john.ogness at linutronix.de
Thu Sep 13 09:24:04 CEST 2018


On 2018-09-12, Manuel Traut <manut at linutronix.de> wrote:
> 6b3fb9d01f170e708f357ea6c5f2b0e356ef0f3d removed the initiailization of
> the retry variable, but not all usage. Because the commit
> 740690f56b0d79076face12ac365a18bde70af76 introducing the retry logic was
> done for some reason, so we decided to keep the logic:
> http://elbe-devel.2373613.n4.nabble.com/elbe-devel-PATCH-soapclient-download-file-fix-uninitialized-retry-tt1241.html#none
> and add a verbose printout of the exception.
>
> Also a comment is added, that the retry exception can be removed, if
> those message didn't appear for a while.
>
> This fixes github issue #171
>
> Signed-off-by: Manuel Traut <manut at linutronix.de>

Reviewd-by: John Ogness <john.ogness at linutronix.de>

> ---
>  elbepack/soapclient.py | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> changes since v3:
>
>   * v3 was a completely different patch (with another subject) sent accidently
>      in this thread.
>
> changes since v2:
>
>   * add variable to store exception in, otherwise an unitialized variable 'e'
>       will be used
>
> diff --git a/elbepack/soapclient.py b/elbepack/soapclient.py
> index fbb29a97..9c9a610c 100644
> --- a/elbepack/soapclient.py
> +++ b/elbepack/soapclient.py
> @@ -82,11 +82,22 @@ class ElbeSoapClient(object):
>          fp = file(dst_fname, "w")
>          part = 0
>  
> +        # XXX the retry logic might get removed in the future, if the error
> +        # doesn't occur in real world. If it occurs, we should think about
> +        # the root cause instead of stupid retrying.
> +        retry = 5
> +
>          while True:
>              try:
>                  ret = self.service.get_file(builddir, filename, part)
>              except BadStatusLine as e:
>                  retry = retry - 1
> +
> +                print("get_file part %d failed, retry %d times" % (part, retry),
> +                      file=sys.stderr)
> +                print(e.message, file=sys.stderr)
> +                print(repr(e.line), file=sys.stderr)
> +
>                  if not retry:
>                      fp.close()
>                      print("file transfer failed", file=sys.stderr)



More information about the elbe-devel mailing list