mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-09-24 10:18:42 +02:00
fix(tests): do not try to start the perl connector if it is not installed (#5726)
Refs: CTOR-1889
This commit is contained in:
parent
4730dc1891
commit
369ea5fda2
@ -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())
|
||||
|
Loading…
x
Reference in New Issue
Block a user