mirror of
https://github.com/krkn-chaos/krkn.git
synced 2026-04-15 06:57:28 +00:00
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
22 lines
609 B
Python
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
|