From c84b462ac00dbc42edaf6623ba2fff7eb270a782 Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Fri, 1 Oct 2021 07:58:17 -0500 Subject: [PATCH] Fix python config fetch disrupted by stderr output (#13295) * Fix python config fetch disrupted by stderr output I have no idea how to make command_runner not include debug output, so just use subprocess.check_output * restore import --- LibreNMS/__init__.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/LibreNMS/__init__.py b/LibreNMS/__init__.py index 6d3a291f72..f041851cca 100644 --- a/LibreNMS/__init__.py +++ b/LibreNMS/__init__.py @@ -9,6 +9,7 @@ from collections import deque from logging.handlers import RotatingFileHandler from math import ceil from queue import Queue +from subprocess import check_output from time import time from .command_runner import command_runner @@ -169,10 +170,7 @@ def get_config_data(base_dir): config_cmd = ["/usr/bin/env", "php", "%s/config_to_json.php" % base_dir] try: - exit_code, output = command_runner(config_cmd, timeout=300) - if exit_code == 0: - return json.loads(output) - raise EnvironmentError + return json.loads(check_output(config_cmd).decode()) except Exception as exc: logger.critical("ERROR: Could not execute command [%s]: %s" % (config_cmd, exc)) logger.debug("Traceback:", exc_info=True)