osmith has submitted this change. (
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, 10 insertions(+), 0 deletions(-)
Approvals:
daniel: Looks good to me, but someone else must approve
fixeria: Looks good to me, approved
Jenkins Builder: Verified
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 https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43085?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
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 <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <[email protected]>
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>