From 5b6ff9f418bf2d7218faf0e8ca5bf8a2eb214514 Mon Sep 17 00:00:00 2001 From: BenjiReis Date: Thu, 28 Sep 2023 15:35:12 +0200 Subject: [PATCH] Adapt `gencert` parameters according to XCP-ng version - A new param has been added: `cert_gid` between 8.2 and 8.3 See: https://github.com/xapi-project/xen-api/commit/c59ac1668f30090e9ae3b744b008c4dc36ba29cc Signed-off-by: BenjiReis --- tests/xapi/tls_verification/test_tls_verification.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/xapi/tls_verification/test_tls_verification.py b/tests/xapi/tls_verification/test_tls_verification.py index a8d8ffe8c..13dc908e9 100644 --- a/tests/xapi/tls_verification/test_tls_verification.py +++ b/tests/xapi/tls_verification/test_tls_verification.py @@ -1,6 +1,8 @@ import logging import pytest +from packaging import version + from lib.commands import SSHCommandFailed # Requirements: @@ -69,7 +71,12 @@ def test_break_cert(self, hostA1, hostA2_with_saved_cert): hostA2 = hostA2_with_saved_cert logging.info(f"Replace the certificate on host {hostA2}") hostA2.ssh(['rm', XAPI_POOL_PEM_FILEPATH]) - hostA2.ssh(['/opt/xensource/libexec/gencert', XAPI_POOL_PEM_FILEPATH, 'xapi:pool']) + gencert_cmd = [] + if hostA2.xcp_version >= version.parse("8.3"): + gencert_cmd = ['/opt/xensource/libexec/gencert', XAPI_POOL_PEM_FILEPATH, '-1', 'xapi:pool'] + else: + gencert_cmd = ['/opt/xensource/libexec/gencert', XAPI_POOL_PEM_FILEPATH, 'xapi:pool'] + hostA2.ssh(gencert_cmd) hostA2.ssh(['systemctl', 'reload-or-restart stunnel@xapi']) # Restart toolstack on client host to clear any existing TLS connection hostA1.restart_toolstack(True)