Skip to content

Retry downloads in case it was just an OBS hick #14

@cbosdo

Description

@cbosdo

Adding a max retry as config and defaulting to 3 or 5 would be cool.
While at it printing the URL of the failed download instead of a backtrace would help a lot understanding what happens.

Example of such backtrace:

     [exec] INFO:root:Downloading /tmp/obsmvn-y1hlpv40/ical4j-3.0.18-6.5.uyuni1.noarch.rpm
     [exec] Traceback (most recent call last):
     [exec]   File "/usr/bin/obs-to-maven", line 11, in <module>
     [exec]     load_entry_point('obs-to-maven==1.1.0', 'console_scripts', 'obs-to-maven')()
     [exec]   File "/usr/lib/python3.6/site-packages/obs_maven/core.py", line 79, in main
     [exec]     artifact.process(config.repo, tmp)
     [exec]   File "/usr/lib/python3.6/site-packages/obs_maven/artifact.py", line 223, in process
     [exec]     rpm_file = self.fetch_binary(file, tmp)
     [exec]   File "/usr/lib/python3.6/site-packages/obs_maven/artifact.py", line 63, in fetch_binary
     [exec]     self.repository.get_binary(file.path, target_file, file.mtime)
     [exec]   File "/usr/lib/python3.6/site-packages/obs_maven/repo.py", line 69, in get_binary
     [exec]     f = urllib.request.urlopen("{}/{}/{}/{}".format(self.uri, self.project, self.repository, path))
     [exec]   File "/usr/lib64/python3.6/urllib/request.py", line 223, in urlopen
     [exec]     return opener.open(url, data, timeout)
     [exec]   File "/usr/lib64/python3.6/urllib/request.py", line 532, in open
     [exec]     response = meth(req, response)
     [exec]   File "/usr/lib64/python3.6/urllib/request.py", line 642, in http_response
     [exec]     'http', request, response, code, msg, hdrs)
     [exec]   File "/usr/lib64/python3.6/urllib/request.py", line 570, in error
     [exec]     return self._call_chain(*args)
     [exec]   File "/usr/lib64/python3.6/urllib/request.py", line 504, in _call_chain
     [exec]     result = func(*args)
     [exec]   File "/usr/lib64/python3.6/urllib/request.py", line 650, in http_error_default
     [exec]     raise HTTPError(req.full_url, code, msg, hdrs, fp)
     [exec] urllib.error.HTTPError: HTTP Error 502: Bad Gateway

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions