From 4ce0ac3ba71734897fe83d8849831bed8973d01c Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Thu, 11 Jul 2024 15:06:26 +0200 Subject: [PATCH] removed env override in Popen to allow inheriting http_proxy in issue #427 --- check_yum.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/check_yum.py b/check_yum.py index f905abaa0..7349f9301 100755 --- a/check_yum.py +++ b/check_yum.py @@ -51,7 +51,7 @@ __author__ = "Hari Sekhon" __title__ = "Nagios Plugin for Yum updates on RedHat/CentOS systems" -__version__ = "0.12.7" +__version__ = "0.12.8" # Standard Nagios return codes OK = 0 @@ -175,17 +175,16 @@ def run(self, cmd): self.vprint(2, "running command: %s" % cmd) + os.environ['LANG'] = 'en_US' if OLD_PYTHON: self.vprint(3, "subprocess not available, probably old python " \ + "version, using shell instead") - os.environ['LANG'] = "en_US" returncode, stdout = getstatusoutput(cmd) if returncode >= 256: returncode = returncode / 256 else: try: - env = {'LANG': 'en_US'} - process = Popen(cmd.split(), stdin=PIPE, stdout=PIPE, stderr=STDOUT, env=env) + process = Popen(cmd.split(), stdin=PIPE, stdout=PIPE, stderr=STDOUT) except OSError as error: error = str(error) if error == "No such file or directory":