config: ssh: Add passphrase and ask_passphrase options.

Bump `dvc-ssh`.

Fixes #8137
This commit is contained in:
David de la Iglesia Castro
2022-10-14 12:11:31 +03:00
committed by Ruslan Kuprieiev
parent ed87c308ba
commit 3bbf8fa7d2
3 changed files with 17 additions and 8 deletions
+2
View File
@@ -180,6 +180,8 @@ SCHEMA = {
"user": str, "user": str,
"password": str, "password": str,
"ask_password": Bool, "ask_password": Bool,
"passphrase": str,
"ask_passphrase": Bool,
"keyfile": str, "keyfile": str,
"timeout": Coerce(int), "timeout": Coerce(int),
"gss_auth": Bool, "gss_auth": Bool,
+3 -3
View File
@@ -95,11 +95,11 @@ hdfs =
dvc-hdfs==2.19.0; python_version < '3.11' dvc-hdfs==2.19.0; python_version < '3.11'
oss = dvc-oss==2.19.0 oss = dvc-oss==2.19.0
s3 = dvc-s3==2.20.1 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 # 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 # for Linux, so it will fail to compile if user doesn't have all the
# requirements, including kerberos itself. # 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 webdav = dvc-webdav==2.19.0
webhdfs = dvc-webhdfs==2.19.0 webhdfs = dvc-webhdfs==2.19.0
# requests-kerberos requires krb5 & gssapi, which does not provide wheels Linux # requests-kerberos requires krb5 & gssapi, which does not provide wheels Linux
@@ -109,7 +109,7 @@ testing =
pytest-test-utils==0.0.8 pytest-test-utils==0.0.8
tests = tests =
%(terraform)s %(terraform)s
dvc-ssh==2.19.0 dvc-ssh==2.20.0
# Test requirements # Test requirements
pytest==7.1.3 pytest==7.1.3
pytest-cov==4.0.0 pytest-cov==4.0.0
+12 -5
View File
@@ -34,18 +34,25 @@ def test_get_kwargs_from_urls():
def test_init(): def test_init():
fs = SSHFileSystem( 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["username"] == "test"
assert fs.fs_args["host"] == "12.34.56.78" assert fs.fs_args["host"] == "12.34.56.78"
assert fs.fs_args["port"] == "1234" 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") mocker.patch("dvc_ssh.ask_password", return_value="fish")
fs = SSHFileSystem(user="test", host="2.2.2.2", ask_password=True) args = {f"ask_{option}": True}
assert fs.fs_args["password"] == fs.fs_args["passphrase"] == "fish" fs = SSHFileSystem(user="test", host="2.2.2.2", **args)
assert fs.fs_args[option] == "fish"
mock_ssh_config = """ mock_ssh_config = """