Skip to content

Commit

Permalink
Allow transport override on winrm backend
Browse files Browse the repository at this point in the history
  • Loading branch information
jpic authored and philpep committed Nov 13, 2023
1 parent c99c289 commit 50c9ced
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/source/backends.rst
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ The winrm backend uses `pywinrm <https://pypi.python.org/pypi/pywinrm>`_::

$ py.test --hosts='winrm://Administrator:Password@127.0.0.1'
$ py.test --hosts='winrm://vagrant@127.0.0.1:2200?no_ssl=true&no_verify_ssl=true'
$ py.test --hosts='winrm://vagrant@127.0.0.1:2200?no_ssl=true&no_verify_ssl=true&transport=plaintext'

pywinrm's default read and operation timeout can be overridden using query
arguments ``read_timeout_sec`` and ``operation_timeout_sec``::
Expand Down
1 change: 1 addition & 0 deletions testinfra/backend/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def parse_hostspec(hostspec: str) -> tuple[str, dict[str, Any]]:
"controlpersist",
"kubeconfig",
"context",
"transport",
):
if key in query:
kw[key] = query[key][0]
Expand Down
3 changes: 2 additions & 1 deletion testinfra/backend/winrm.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def __init__(
no_verify_ssl: bool = False,
read_timeout_sec: Optional[int] = None,
operation_timeout_sec: Optional[int] = None,
transport: str = None,
*args: Any,
**kwargs: Any,
):
Expand All @@ -66,7 +67,7 @@ def __init__(
self.host.name,
":{}".format(self.host.port) if self.host.port else "",
),
"transport": "ntlm",
"transport": transport or "ntlm",
"username": self.host.user,
"password": self.host.password,
}
Expand Down

0 comments on commit 50c9ced

Please sign in to comment.