osmith submitted this change.

View Change



1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.

Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved pespin: Looks good to me, but someone else must approve
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.

Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I29ebe200258a9a9ffb127ec8fa1260b7e2124c38
Gerrit-Change-Number: 38258
Gerrit-PatchSet: 3
Gerrit-Owner: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>