Files
krkn/kraken/invoke/command.py
Yashashree Suresh 31f06b861a Added node scenarios to stop and terminate instance
This commit:
- Adds a node scenario to stop and start an instance
- Adds a node scenario to terminate an instance
- Adds a node scenario to reboot an instance
- Adds a node scenario to stop the kubelet
- Adds a node scenario to crash the node
2020-08-27 16:50:42 -04:00

22 lines
609 B
Python

import subprocess
import logging
# Invokes a given command and returns the stdout
def invoke(command):
try:
output = subprocess.Popen(command, shell=True,
universal_newlines=True, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
(out, err) = output.communicate()
except Exception as e:
logging.error("Failed to run %s, error: %s" % (command, e))
return out
def run(command):
try:
subprocess.run(command, shell=True, universal_newlines=True, timeout=45)
except Exception:
pass