Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
client: add failure handling to fetch_results
Fixes the following Traceback for tasks without any results: ``` $ osh/client/osh-cli download-results 1 Downloading dotnet3.1-3.1.424-1.fc35.tar.xz Traceback (most recent call last): File "/Users/lzaoral/redhat/OpenScanHub/osh/client/osh-cli", line 79, in <module> main() File "/Users/lzaoral/redhat/OpenScanHub/osh/client/osh-cli", line 72, in main parser.run() File "/Users/lzaoral/redhat/OpenScanHub/kobo/kobo/cli.py", line 296, in run cmd.run(*cmd_args, **cmd_kwargs) File "/Users/lzaoral/redhat/OpenScanHub/osh/client/commands/cmd_download_results.py", line 51, in run fetch_results(self.hub, results_dir, task_id) File "/Users/lzaoral/redhat/OpenScanHub/osh/client/commands/shortcuts.py", line 138, in fetch_results urlretrieve(url, local_path) File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 241, in urlretrieve with contextlib.closing(urlopen(url, data)) as fp: ^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 216, in urlopen return opener.open(url, data, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 525, in open response = meth(req, response) ^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 634, in http_response response = self.parent.error( ^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 563, in error return self._call_chain(*args) ^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 496, in _call_chain result = func(*args) ^^^^^^^^^^^ File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 643, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 404: Not Found ``` Related: release-engineering/kobo#214 Related: https://gitlab.cee.redhat.com/covscan/covscan/-/issues/273
- Loading branch information