fix(tests): do not try to start the perl connector if it is not installed (#5726)

Refs: CTOR-1889
This commit is contained in:
Sylvain Cresto 2025-08-29 10:16:31 +02:00 committed by GitHub
parent 4730dc1891
commit 369ea5fda2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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())