Make run_simple_command part of DockerRunner

This commit is contained in:
Ayaz Salikhov
2021-05-02 12:45:05 +03:00
parent 27f45c7f2c
commit 7d7bbba09f
3 changed files with 24 additions and 16 deletions

View File

@@ -28,12 +28,12 @@ class DockerRunner:
self.container.remove(force=True)
logger.info(f"Container {self.container.name} removed")
def run_simple_command(container, cmd, print_result=True):
logger.info(f"Running cmd: '{cmd}' on container: {container}")
out = container.exec_run(cmd)
assert out.exit_code == 0, f"Command: {cmd} failed"
result = out.output.decode("utf-8").rstrip()
if print_result:
logger.info(f"Command result: {result}")
return result
@staticmethod
def run_simple_command(container, cmd, print_result=True):
logger.info(f"Running cmd: '{cmd}' on container: {container}")
out = container.exec_run(cmd)
assert out.exit_code == 0, f"Command: {cmd} failed"
result = out.output.decode("utf-8").rstrip()
if print_result:
logger.info(f"Command result: {result}")
return result