Files
krkn/scenarios/post_action_etcd_example_py.py
Amit Sagtani d00d6ec69e Install pre-commit and use GitHub Actions (#94)
* added pre-commit and code-cleaning

* removed tox and TravisCI
2021-05-05 09:53:45 -04:00

24 lines
662 B
Python
Executable File

#!/usr/bin/env python3
import subprocess
import logging
def run(cmd):
try:
output = subprocess.Popen(
cmd, shell=True, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT
)
(out, err) = output.communicate()
logging.info("out " + str(out))
except Exception as e:
logging.error("Failed to run %s, error: %s" % (cmd, e))
return out
pods_running = run("oc get pods -n openshift-etcd | grep -c Running").rstrip()
if pods_running == str(3):
print("There were 3 pods running properly")
else:
print("ERROR there were " + str(pods_running) + " pods running instead of 3")