osmith submitted this change.

View Change

Approvals: daniel: Looks good to me, but someone else must approve fixeria: Looks good to me, approved Jenkins Builder: Verified
testenv: init: check distro argument early

Check the --distro argument and print a proper error, instead of failing
later on with a stack trace if it is unsupported.

Change-Id: I9d51c2b236f10f4c10e991873df47b4f3297e6e1
---
M _testenv/testenv/__init__.py
1 file changed, 10 insertions(+), 0 deletions(-)

diff --git a/_testenv/testenv/__init__.py b/_testenv/testenv/__init__.py
index b9ec676..ed302ab 100644
--- a/_testenv/testenv/__init__.py
+++ b/_testenv/testenv/__init__.py
@@ -260,6 +260,15 @@
args.podman = False


+def verify_args_init():
+ if args.action != "init":
+ return
+
+ distro_arg = getattr(args, "distro", None)
+ if distro_arg and distro_arg not in distros_repodirs:
+ raise NoTraceException(f"--distro must be one of {', '.join(distros_repodirs)}")
+
+
def verify_args_run():
if args.action != "run":
return
@@ -304,6 +313,7 @@

def init_args():
parse_args()
+ verify_args_init()
verify_args_run()
set_args_defaults()


To view, visit change 43085. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I9d51c2b236f10f4c10e991873df47b4f3297e6e1
Gerrit-Change-Number: 43085
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann@sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>