From 369ea5fda264fe16b33f357a3a13a4e848291853 Mon Sep 17 00:00:00 2001 From: Sylvain Cresto Date: Fri, 29 Aug 2025 10:16:31 +0200 Subject: [PATCH] fix(tests): do not try to start the perl connector if it is not installed (#5726) Refs: CTOR-1889 --- tests/resources/connector.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/resources/connector.py b/tests/resources/connector.py index c3ff0c4ea..79659adda 100644 --- a/tests/resources/connector.py +++ b/tests/resources/connector.py @@ -3,6 +3,7 @@ import time import os from robot.api.deco import keyword import re +import sys connector = None @@ -12,13 +13,16 @@ class ConnectorLibrary: def ctn_start_connector(self, command=["/usr/lib64/centreon-connector/centreon_connector_perl", "--log-file=/tmp/connector.log", "--debug"]): if self.process is None or self.process.poll() is not None: - self.process = subprocess.Popen( - command, - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, # Capture stdout! - text=True - ) - print("Connector started") + try: + self.process = subprocess.Popen( + command, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, # Capture stdout! + text=True + ) + print("Connector started") + except FileNotFoundError: + print("Perl connector binary not found. Falling back to local test.", file=sys.stderr) def ctn_send_to_connector(self, idf: int, command: str, timeout: int, command_log="/tmp/connector.commands.log"): now = int(time.time())