osmith submitted this change.
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
testenv: podman.exec_cmd: better error if stopped
Testenv may try to run a comand in podman after the container was
stopped, if there is a bug in the shutdown logic. Give a meaningful
error in that case, instead of failing later on with a cryptic error in
subprocess.run() because None was passed inside cmd (for the container
name) instead of a string.
Change-Id: I29ebe200258a9a9ffb127ec8fa1260b7e2124c38
---
M _testenv/testenv/podman.py
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/_testenv/testenv/podman.py b/_testenv/testenv/podman.py
index 6d801fa..53806a4 100644
--- a/_testenv/testenv/podman.py
+++ b/_testenv/testenv/podman.py
@@ -131,6 +131,10 @@
def exec_cmd(cmd, podman_opts=[], cwd=None, env={}, *args, **kwargs):
+ if not container_name:
+ raise RuntimeError("Attempting to execute a command in podman, but the"
+ f" container isn't running anymore: {cmd}")
+
podman_opts = list(podman_opts)
podman_opts += generate_env_podman(env)
# Attach a fake tty (eclipse-titan won't print colored output otherwise)
To view, visit change 38258. To unsubscribe, or for help writing mail filters, visit settings.