healthy-checker/app/checks/shell.py

15 lines
321 B
Python

import subprocess
async def run(check):
result = subprocess.run(
check["command"],
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
ok = result.returncode == 0
return {
"status": "PASS" if ok else "FAIL",
"stdout": result.stdout.decode()
}