Skip to content

Commit

Permalink
removed env override in Popen to allow inheriting http_proxy in issue #…
Browse files Browse the repository at this point in the history
  • Loading branch information
HariSekhon committed Jul 11, 2024
1 parent 74d3cff commit 4ce0ac3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions check_yum.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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":
Expand Down

0 comments on commit 4ce0ac3

Please sign in to comment.