Skip to content

Commit a1aa105

Browse files
authored
Merge branch 'main' into ip_module
2 parents ddfcccf + 01db77f commit a1aa105

File tree

13 files changed

+58
-71
lines changed

13 files changed

+58
-71
lines changed

CHANGELOG.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22
Changelog
33
=========
44

5+
9.0.0
6+
=====
7+
8+
* [BREAKING] pytest-testinfra now require python >= 3.9
9+
* [BREAKING] Drop deprecated module PipPackage
10+
* [NEW] Add support for the SSH ControlPath connection sharing option (#713)
11+
* [FIX] Retry SSH on ConnectionResetError (#708)
12+
* [FIX] List openSUSE Leap and Tumbleweed explicitly as rpm based distributions
13+
* [FIX] Make group name mandatory in group module
14+
515
8.1.0
616
=====
717

dev-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
sphinx>=1.3
1+
sphinx>=7.1,<7.2
22
alabaster>=0.7.2
33
.

doc/source/modules.rst

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,6 @@ host
7070

7171
:class:`testinfra.modules.pip.Pip` class
7272

73-
.. attribute:: pip_package
74-
75-
:class:`testinfra.modules.pip.PipPackage` class
76-
7773
.. attribute:: podman
7874

7975
:class:`testinfra.modules.podman.Podman` class
@@ -215,12 +211,6 @@ Pip
215211
:members:
216212

217213

218-
PipPackage
219-
~~~~~~~~~~
220-
221-
.. autoclass:: testinfra.modules.pip.PipPackage
222-
223-
224214
Podman
225215
~~~~~~
226216

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ long_description = file:README.rst
66
long_description_content_type = text/x-rst
77
author = Philippe Pepiot
88
author_email = phil@philpep.org
9-
license_file = LICENSE
9+
license_files = LICENSE
1010
classifiers =
1111
Development Status :: 5 - Production/Stable
1212
Environment :: Console

test/test_backends.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,14 @@ def get_vars(host):
183183
"c": "d",
184184
"x": "z",
185185
"inventory_hostname": "debian",
186-
"group_names": ["g"],
186+
"group_names": ["all", "g"],
187187
"groups": groups,
188188
}
189189
assert get_vars("rockylinux") == {
190190
"a": "a",
191191
"e": "f",
192192
"inventory_hostname": "rockylinux",
193-
"group_names": ["ungrouped"],
193+
"group_names": ["all", "ungrouped"],
194194
"groups": groups,
195195
}
196196

test/test_modules.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ def test_ansible_module(host):
348348
assert variables["myhostvar"] == "bar"
349349
assert variables["mygroupvar"] == "qux"
350350
assert variables["inventory_hostname"] == "debian_bookworm"
351-
assert variables["group_names"] == ["testgroup"]
351+
assert variables["group_names"] == ["all", "testgroup"]
352352
assert variables["groups"] == {
353353
"all": ["debian_bookworm"],
354354
"testgroup": ["debian_bookworm"],

testinfra/backend/paramiko.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def run(self, command: str, *args: str, **kwargs: Any) -> base.CommandResult:
148148
cmd = self.encode(command)
149149
try:
150150
rc, stdout, stderr = self._exec_command(cmd)
151-
except paramiko.ssh_exception.SSHException:
151+
except (paramiko.ssh_exception.SSHException, ConnectionResetError):
152152
transport = self.client.get_transport()
153153
assert transport is not None
154154
if not transport.is_active():

testinfra/backend/ssh.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def __init__(
2727
ssh_config: Optional[str] = None,
2828
ssh_identity_file: Optional[str] = None,
2929
timeout: int = 10,
30+
controlpath: str = "",
3031
controlpersist: int = 60,
3132
ssh_extra_args: Optional[str] = None,
3233
*args: Any,
@@ -36,6 +37,7 @@ def __init__(
3637
self.ssh_config = ssh_config
3738
self.ssh_identity_file = ssh_identity_file
3839
self.timeout = int(timeout)
40+
self.controlpath = controlpath
3941
self.controlpersist = int(controlpersist)
4042
self.ssh_extra_args = ssh_extra_args
4143
super().__init__(self.host.name, *args, **kwargs)
@@ -75,6 +77,12 @@ def _build_ssh_command(self, command: str) -> tuple[list[str], list[str]]:
7577
self.controlpersist
7678
)
7779
)
80+
if (
81+
"ControlMaster" in " ".join(cmd)
82+
and self.controlpath
83+
and ("controlpath" not in (self.ssh_extra_args or "").lower())
84+
):
85+
cmd.append("-o ControlPath={}".format(self.controlpath))
7886
cmd.append("%s %s")
7987
cmd_args.extend([self.host.name, command])
8088
return cmd, cmd_args

testinfra/modules/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
"mount_point": "mountpoint:MountPoint",
3232
"package": "package:Package",
3333
"pip": "pip:Pip",
34-
"pip_package": "pip:PipPackage",
3534
"process": "process:Process",
3635
"puppet_resource": "puppet:PuppetResource",
3736
"facter": "puppet:Facter",

testinfra/modules/package.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ def get_module_class(cls, host):
7777
"centos",
7878
"cloudlinux",
7979
"fedora",
80+
"opensuse-leap",
81+
"opensuse-tumbleweed",
8082
"rocky",
8183
)
8284
):

0 commit comments

Comments
 (0)