Skip to content

Commit

Permalink
odb: move verify option to config
Browse files Browse the repository at this point in the history
These options are part of the default config for each particular remote.
Plugins will define their default config on theirown, but for now we keep
those in one config schema.
  • Loading branch information
efiop committed Dec 23, 2021
1 parent 60cb832 commit 72aaca4
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 23 deletions.
11 changes: 10 additions & 1 deletion dvc/config_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ class RelPath(str):
"checksum_jobs": All(Coerce(int), Range(1)),
"jobs": All(Coerce(int), Range(1)),
Optional("no_traverse"): Bool, # obsoleted
"verify": Bool,
}
LOCAL_COMMON = {
"type": supported_cache_type,
Optional("protected", default=False): Bool, # obsoleted
"shared": All(Lower, Choices("group")),
Optional("slow_link_warning", default=True): Bool,
Optional("verify", default=False): Bool,
}
HTTP_COMMON = {
"auth": All(Lower, Choices("basic", "digest", "custom")),
Expand All @@ -95,6 +95,7 @@ class RelPath(str):
"ask_password": Bool,
"ssl_verify": Any(Bool, str),
"method": str,
Optional("verify", default=False): Bool,
}
WEBDAV_COMMON = {
"user": str,
Expand All @@ -105,6 +106,7 @@ class RelPath(str):
"key_path": str,
"timeout": Coerce(int),
"ssl_verify": Any(Bool, str),
Optional("verify", default=False): Bool,
}

SCHEMA = {
Expand Down Expand Up @@ -158,11 +160,13 @@ class RelPath(str):
"cache_regions": bool,
"read_timeout": Coerce(int),
"connect_timeout": Coerce(int),
Optional("verify", default=False): Bool,
**REMOTE_COMMON,
},
"gs": {
"projectname": str,
"credentialpath": str,
Optional("verify", default=False): Bool,
**REMOTE_COMMON,
},
"ssh": {
Expand All @@ -175,6 +179,7 @@ class RelPath(str):
"timeout": Coerce(int),
"gss_auth": Bool,
"allow_agent": Bool,
Optional("verify", default=False): Bool,
**REMOTE_COMMON,
},
"hdfs": {"user": str, "kerb_ticket": str, **REMOTE_COMMON},
Expand All @@ -185,6 +190,7 @@ class RelPath(str):
"ssl_verify": Any(Bool, str),
"token": str,
"use_https": Bool,
Optional("verify", default=False): Bool,
**REMOTE_COMMON,
},
"azure": {
Expand All @@ -200,12 +206,14 @@ class RelPath(str):
"exclude_visual_studio_code_credential": Bool,
"exclude_shared_token_cache_credential": Bool,
"exclude_managed_identity_credential": Bool,
Optional("verify", default=False): Bool,
**REMOTE_COMMON,
},
"oss": {
"oss_key_id": str,
"oss_key_secret": str,
"oss_endpoint": str,
Optional("verify", default=True): Bool,
**REMOTE_COMMON,
},
"gdrive": {
Expand All @@ -216,6 +224,7 @@ class RelPath(str):
"gdrive_service_account_user_email": str,
"gdrive_service_account_json_file_path": str,
Optional("gdrive_trash_only", default=False): Bool,
Optional("verify", default=True): Bool,
**REMOTE_COMMON,
},
"http": {**HTTP_COMMON, **REMOTE_COMMON},
Expand Down
8 changes: 0 additions & 8 deletions dvc/objects/db/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,11 @@

def get_odb(fs, fs_path, **config):
from .base import ObjectDB
from .gdrive import GDriveObjectDB
from .local import LocalObjectDB
from .oss import OSSObjectDB

if fs.scheme == Schemes.LOCAL:
return LocalObjectDB(fs, fs_path, **config)

if fs.scheme == Schemes.GDRIVE:
return GDriveObjectDB(fs, fs_path, **config)

if fs.scheme == Schemes.OSS:
return OSSObjectDB(fs, fs_path, **config)

return ObjectDB(fs, fs_path, **config)


Expand Down
5 changes: 0 additions & 5 deletions dvc/objects/db/gdrive.py

This file was deleted.

9 changes: 0 additions & 9 deletions dvc/objects/db/oss.py

This file was deleted.

1 change: 1 addition & 0 deletions tests/func/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ def test_merging_two_levels(dvc):
assert dvc.config["remote"]["test"] == {
"url": "ssh://example.com",
"password": "1",
"verify": False,
}


Expand Down
1 change: 1 addition & 0 deletions tests/func/test_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ def test_remote_modify_local_on_repo_config(tmp_dir, dvc):
assert dvc.config["remote"]["myremote"] == {
"url": "http://example.com/path",
"user": "xxx",
"verify": False,
}


Expand Down

0 comments on commit 72aaca4

Please sign in to comment.