Skip to content

Commit

Permalink
explicitly disable subprocess check mode
Browse files Browse the repository at this point in the history
which is the default
  • Loading branch information
stdevel committed Jul 16, 2022
1 parent 89a0c11 commit e569259
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions check_omd.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def get_site_status():
Retrieves a particular site's status
"""
# get username
proc = subprocess.run(["whoami"], stdout=subprocess.PIPE)
proc = subprocess.run(["whoami"], stdout=subprocess.PIPE, check=False)
site = proc.stdout.decode('utf-8').rstrip()
LOGGER.debug("It seems like I'm OMD site '%s'", site)

Expand All @@ -53,7 +53,13 @@ def get_site_status():
LOGGER.debug("running command '%s'", cmd)

try:
proc = subprocess.run(cmd,timeout=OPTIONS.timeout,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
proc = subprocess.run(
cmd,
timeout=OPTIONS.timeout,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
check=False
)
except subprocess.TimeoutExpired:
raise_timeout(cmd,timeout=OPTIONS.timeout)

Expand Down Expand Up @@ -98,7 +104,7 @@ def get_site_status():
cmd = ['omd', 'restart', service]
LOGGER.debug("running command '%s'", cmd)
try:
proc = subprocess.run(cmd,timeout=OPTIONS.timeout)
proc = subprocess.run(cmd,timeout=OPTIONS.timeout, check=False)
except subprocess.TimeoutExpired:
raise_timeout(cmd,OPTIONS.timeout)

Expand Down

0 comments on commit e569259

Please sign in to comment.