osmith has uploaded this change for review.

View Change

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, 9 insertions(+), 0 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/85/43085/1
diff --git a/_testenv/testenv/__init__.py b/_testenv/testenv/__init__.py
index b9ec676..0f70f8a 100644
--- a/_testenv/testenv/__init__.py
+++ b/_testenv/testenv/__init__.py
@@ -260,6 +260,14 @@
args.podman = False


+def verify_args_init():
+ if args.action != "init":
+ return
+
+ if args.distro and args.distro 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 +312,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: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I9d51c2b236f10f4c10e991873df47b4f3297e6e1
Gerrit-Change-Number: 43085
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith@sysmocom.de>