diff --git a/dvc/fs/azure.py b/dvc/fs/azure.py index e89c8cbcc..80dcdfd4a 100644 --- a/dvc/fs/azure.py +++ b/dvc/fs/azure.py @@ -48,8 +48,6 @@ class AzureFileSystem(FSSpecWrapper): self.path_info = self.PATH_CLS(url) self.bucket = self.path_info.bucket - self.login_method, self.login_info = self._prepare_credentials(config) - def _prepare_credentials(self, config): from azure.identity.aio import DefaultAzureCredential @@ -90,7 +88,8 @@ class AzureFileSystem(FSSpecWrapper): else: login_method = None - return login_method, login_info + self.login_method = login_method + return login_info @cached_property def _az_config(self): @@ -111,7 +110,7 @@ class AzureFileSystem(FSSpecWrapper): from azure.core.exceptions import AzureError try: - file_system = AzureBlobFileSystem(**self.login_info) + file_system = AzureBlobFileSystem(**self.fs_args) if self.bucket not in [ container.rstrip("/") for container in file_system.ls("/") ]: diff --git a/dvc/fs/fsspec_wrapper.py b/dvc/fs/fsspec_wrapper.py index 3896b73e2..0470b5da6 100644 --- a/dvc/fs/fsspec_wrapper.py +++ b/dvc/fs/fsspec_wrapper.py @@ -9,6 +9,11 @@ from .base import BaseFileSystem # pylint: disable=no-member class FSSpecWrapper(BaseFileSystem): + def __init__(self, repo, config): + super().__init__(repo, config) + self.fs_args = {"skip_instance_cache": True} + self.fs_args.update(self._prepare_credentials(config)) + def fs(self): raise NotImplementedError @@ -44,6 +49,11 @@ class FSSpecWrapper(BaseFileSystem): entries within info() and ls(detail=True) calls""" return entry + def _prepare_credentials(self, config): # pylint: disable=unused-argument + """Prepare the arguments for authentication to the + host filesystem""" + return {} + def isdir(self, path_info): if not self.exists(path_info): return False diff --git a/dvc/fs/gs.py b/dvc/fs/gs.py index 74f643732..fd90ef7c3 100644 --- a/dvc/fs/gs.py +++ b/dvc/fs/gs.py @@ -22,10 +22,8 @@ class GSFileSystem(FSSpecWrapper): url = config.get("url", "gs://") self.path_info = self.PATH_CLS(url) - self.login_info = self._prepare_credentials(config) - def _prepare_credentials(self, config): - login_info = {} + login_info = {"consistency": None} login_info["project"] = config.get("projectname") login_info["token"] = config.get("credentialpath") return login_info @@ -40,4 +38,4 @@ class GSFileSystem(FSSpecWrapper): def fs(self): from gcsfs import GCSFileSystem - return GCSFileSystem(**self.login_info, consistency=None) + return GCSFileSystem(**self.fs_args)