Improve logs

This commit is contained in:
Ayaz Salikhov
2021-03-22 15:00:13 +03:00
parent 20e12b93f2
commit 14dfb27d6b
2 changed files with 5 additions and 4 deletions

View File

@@ -29,10 +29,11 @@ class DockerRunner:
logger.info(f"Container {self.container.name} removed")
def run_simple_command(container, cmd):
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").strip()
logger.info(f"Command result: {result}")
if print_result:
logger.info(f"Command result: {result}")
return result