From 23e67d0c3f4bdcb79874f5897bef28111450cac8 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 29 Aug 2024 17:37:16 -0400 Subject: [PATCH 1/2] Provide detail on why CHECKURL failed for datalad and archive special remotes Inspired by - https://github.com/datalad/datalad-container/issues/267 but to be of benefit, requires review/merge/release of - https://github.com/Lykos153/AnnexRemote/pull/106 But should be safe otherwise since ATM (without the above PR) AnnexRemote simply ignores the message --- datalad/customremotes/archives.py | 2 +- datalad/customremotes/datalad.py | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/datalad/customremotes/archives.py b/datalad/customremotes/archives.py index 2ec905dc67..3363d5c407 100644 --- a/datalad/customremotes/archives.py +++ b/datalad/customremotes/archives.py @@ -312,7 +312,7 @@ def checkurl(self, url): else: # TODO: theoretically we should first check if key is available # from any remote to know if file is available - return False + raise RemoteError(f"archive key {akey} is not available locally.") def checkpresent(self, key): # TODO: so we need to maintain mapping from urls to keys. Then diff --git a/datalad/customremotes/datalad.py b/datalad/customremotes/datalad.py index 673c7695de..b50b17b164 100644 --- a/datalad/customremotes/datalad.py +++ b/datalad/customremotes/datalad.py @@ -13,6 +13,9 @@ import logging from urllib.parse import urlparse +from datalad.customremotes import RemoteError +from datalad.customremotes.base import AnnexCustomRemote +from datalad.customremotes.main import main as super_main from datalad.downloaders.providers import Providers from datalad.support.exceptions import ( CapturedException, @@ -20,10 +23,6 @@ ) from datalad.utils import unique -from datalad.customremotes import RemoteError -from datalad.customremotes.base import AnnexCustomRemote -from datalad.customremotes.main import main as super_main - lgr = logging.getLogger('datalad.customremotes.datalad') @@ -72,7 +71,7 @@ def checkurl(self, url): except Exception as exc: ce = CapturedException(exc) self.message("Failed to check url %s: %s" % (url, ce)) - return False + raise RemoteError(str(ce)) def checkpresent(self, key): resp = None From 2aaf68ef78fa01d9a68c629b8c2e2829000df80a Mon Sep 17 00:00:00 2001 From: DataLad Bot Date: Thu, 29 Aug 2024 21:48:02 +0000 Subject: [PATCH 2/2] [release-action] Autogenerate changelog snippet for PR 7648 --- changelog.d/pr-7648.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelog.d/pr-7648.md diff --git a/changelog.d/pr-7648.md b/changelog.d/pr-7648.md new file mode 100644 index 0000000000..5f9d10c125 --- /dev/null +++ b/changelog.d/pr-7648.md @@ -0,0 +1,3 @@ +### 🐛 Bug Fixes + +- Provide detail on why CHECKURL failed for datalad and archive special remotes (would require new AnnexRemote release (above 1.6.5) to take advantage of this PR). [PR #7648](https://github.com/datalad/datalad/pull/7648) (by [@yarikoptic](https://github.com/yarikoptic))