diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2023-04-06 18:58:43 +0300 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2023-04-06 18:58:43 +0300 |
commit | 9616ae8068814cd07e5e935827e84930921be118 (patch) | |
tree | c11e48f6806fd7b1093f39179372573c5be8f42a | |
parent | 151f8222b58472cf2799f0a69a0057aad81d1f4b (diff) |
Improve error handling for untest|vault with invalid package name
Produce an error message for untest|vault with invalid package name, rather than a python backtrace.
-rw-r--r-- | calm/tool_util.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/calm/tool_util.py b/calm/tool_util.py index f677f86..dc4d882 100644 --- a/calm/tool_util.py +++ b/calm/tool_util.py @@ -48,8 +48,12 @@ def permitted(p): logging.error("who are you?") return False - # CYGNAME is a maintainer for package pkg_list = maintainers.pkg_list(common_constants.PKGMAINT) + if p not in pkg_list: + logging.error("%s is not a package name" % p) + return False + + # CYGNAME is a maintainer for package if cygname in pkg_list[p].maintainers(): return True |