mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-01 23:08:43 +01:00
config: ssh: Add passphrase and ask_passphrase options.
Bump `dvc-ssh`. Fixes #8137
This commit is contained in:
committed by
Ruslan Kuprieiev
parent
ed87c308ba
commit
3bbf8fa7d2
@@ -180,6 +180,8 @@ SCHEMA = {
|
||||
"user": str,
|
||||
"password": str,
|
||||
"ask_password": Bool,
|
||||
"passphrase": str,
|
||||
"ask_passphrase": Bool,
|
||||
"keyfile": str,
|
||||
"timeout": Coerce(int),
|
||||
"gss_auth": Bool,
|
||||
|
||||
@@ -95,11 +95,11 @@ hdfs =
|
||||
dvc-hdfs==2.19.0; python_version < '3.11'
|
||||
oss = dvc-oss==2.19.0
|
||||
s3 = dvc-s3==2.20.1
|
||||
ssh = dvc-ssh==2.19.0
|
||||
ssh = dvc-ssh==2.20.0
|
||||
# gssapi should not be included in all_remotes, because it doesn't have wheels
|
||||
# for Linux, so it will fail to compile if user doesn't have all the
|
||||
# requirements, including kerberos itself.
|
||||
ssh_gssapi = dvc-ssh[gssapi]==2.19.0
|
||||
ssh_gssapi = dvc-ssh[gssapi]==2.20.0
|
||||
webdav = dvc-webdav==2.19.0
|
||||
webhdfs = dvc-webhdfs==2.19.0
|
||||
# requests-kerberos requires krb5 & gssapi, which does not provide wheels Linux
|
||||
@@ -109,7 +109,7 @@ testing =
|
||||
pytest-test-utils==0.0.8
|
||||
tests =
|
||||
%(terraform)s
|
||||
dvc-ssh==2.19.0
|
||||
dvc-ssh==2.20.0
|
||||
# Test requirements
|
||||
pytest==7.1.3
|
||||
pytest-cov==4.0.0
|
||||
|
||||
@@ -34,18 +34,25 @@ def test_get_kwargs_from_urls():
|
||||
|
||||
def test_init():
|
||||
fs = SSHFileSystem(
|
||||
user="test", host="12.34.56.78", port="1234", password="xxx"
|
||||
user="test",
|
||||
host="12.34.56.78",
|
||||
port="1234",
|
||||
password="xxx",
|
||||
passphrase="yyy",
|
||||
)
|
||||
assert fs.fs_args["username"] == "test"
|
||||
assert fs.fs_args["host"] == "12.34.56.78"
|
||||
assert fs.fs_args["port"] == "1234"
|
||||
assert fs.fs_args["password"] == fs.fs_args["passphrase"] == "xxx"
|
||||
assert fs.fs_args["password"] == "xxx"
|
||||
assert fs.fs_args["passphrase"] == "yyy"
|
||||
|
||||
|
||||
def test_ssh_ask_password(mocker):
|
||||
@pytest.mark.parametrize("option", ("password", "passphrase"))
|
||||
def test_ssh_ask_password(mocker, option):
|
||||
mocker.patch("dvc_ssh.ask_password", return_value="fish")
|
||||
fs = SSHFileSystem(user="test", host="2.2.2.2", ask_password=True)
|
||||
assert fs.fs_args["password"] == fs.fs_args["passphrase"] == "fish"
|
||||
args = {f"ask_{option}": True}
|
||||
fs = SSHFileSystem(user="test", host="2.2.2.2", **args)
|
||||
assert fs.fs_args[option] == "fish"
|
||||
|
||||
|
||||
mock_ssh_config = """
|
||||
|
||||
Reference in New Issue
Block a user