osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43085?usp=email )
Change subject: testenv: init: check distro argument early ......................................................................
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()