ipatests: fix expected msg in tasks.run_ssh_cmd

OpenSSH 8.7p1 changed the message logged on successful
authentication (see commit 9e1882ef6489a7dd16b6d7794af96629cae61a53).

As a result, the method run_ssh_cmd is failing and needs to be
adapted in order to be compatible with old and new openssh versions.

Fixes: https://pagure.io/freeipa/issue/8989
Signed-off-by: Florence Blanc-Renaud <flo@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
Florence Blanc-Renaud authored and Rob Crittenden committed 2021-09-14 14:56:42 -04:00
1 parent d43b513927
commit a2e06c385e
1 file changed
+10 -3
+10 -3
View File
@@ -2767,8 +2767,11 @@ def run_ssh_cmd(
if auth_method == "password":
if expect_auth_success is True:
assert "Authentication succeeded (keyboard-interactive)" in \
stderr
patterns = [
r'Authenticated to .* using "keyboard-interactive"',
r'Authentication succeeded \(keyboard-interactive\)'
]
assert any(re.search(pattern, stderr) for pattern in patterns)
# do not assert the return code:
# it can be >0 if the command failed.
elif expect_auth_failure is True:
@@ -2777,7 +2780,11 @@ def run_ssh_cmd(
assert "Authentication succeeded" not in stderr
elif auth_method == "key":
if expect_auth_success is True:
assert "Authentication succeeded (publickey)" in stderr
patterns = [
r'Authenticated to .* using "publickey"',
r'Authentication succeeded \(publickey\)'
]
assert any(re.search(pattern, stderr) for pattern in patterns)
# do not assert the return code:
# it can be >0 if the command failed.
elif expect_auth_failure is True: