nixguix: Deal with impossible communication with server
When that arises, we skip the origins. Related to T3781
This commit is contained in:
parent
a94b75f366
commit
06b11dd5f6
3 changed files with 12 additions and 1 deletions
|
@ -25,6 +25,7 @@ from typing import Any, Dict, Iterator, List, Optional, Tuple, Union
|
|||
from urllib.parse import urlparse
|
||||
|
||||
import requests
|
||||
from requests.exceptions import InvalidSchema, SSLError
|
||||
|
||||
from swh.core.github.utils import GitHubSession
|
||||
from swh.core.tarball import MIMETYPE_TO_ARCHIVE_FORMAT
|
||||
|
@ -155,7 +156,7 @@ def is_tarball(urls: List[str], request: Optional[Any] = None) -> Tuple[bool, st
|
|||
|
||||
try:
|
||||
response = request.head(url)
|
||||
except requests.exceptions.InvalidSchema:
|
||||
except (InvalidSchema, SSLError):
|
||||
raise ArtifactNatureUndetected(
|
||||
f"Cannot determine artifact type from url <{url}>"
|
||||
)
|
||||
|
|
|
@ -24,6 +24,11 @@
|
|||
"type": "url",
|
||||
"urls": [ "unknown://example.org/wrong-scheme-so-skipped.txt" ],
|
||||
"integrity": "sha256-wAEswtkl3ulAw3zq4perrGS6Wlww5XXnQYsEAoYT9fI="
|
||||
},
|
||||
{
|
||||
"type": "url",
|
||||
"urls": [ "https://code.9front.org/hg/plan9front" ],
|
||||
"integrity": "sha256-wAEswtkl3ulAw3zq4perrGS6Wlww5XXnQYsEAoYT9fI="
|
||||
}
|
||||
],
|
||||
"version":"1",
|
||||
|
|
|
@ -235,6 +235,11 @@ def test_lister_nixguix_mostly_noop(datadir, swh_scheduler, requests_mock):
|
|||
"ftp://ftp.ourproject.org/file-with-no-extension",
|
||||
exc=requests.exceptions.InvalidSchema,
|
||||
)
|
||||
# Cannot communicate with an expired cert so skip
|
||||
requests_mock.head(
|
||||
"https://code.9front.org/hg/plan9front",
|
||||
exc=requests.exceptions.SSLError,
|
||||
)
|
||||
|
||||
listed_result = lister.run()
|
||||
# only the origin upstream is listed, every other entries are unsupported or incomplete
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue