Skip to content
Snippets Groups Projects

Remove trailing slash in mpsd_release input

Merged Ashwin Kumar Karnad requested to merge handle-errors-in-release-input into main
1 unresolved thread
2 files
+ 6
8
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -1260,6 +1260,11 @@ def main():
initialize_environment(Path(os.getcwd()))
sys.exit(0)
# sanity check for common mistakes in command line arguments
if args.release.endswith("/"): # happens easily with autocompletion
args.release = args.release.removesuffix("/")
logging.warning(f"Removed trailing slash from release: {args.release}")
    • Perhaps logging.debug would be better than logging.warning. But I am not sure here. Let's use this as is, and perhaps reconsider to change to logging.info or logging.debug later. (Basically: if the warning shows up a lot, and there is no danger in having the extra / at the end.)

      • if we use info, then it gets printed with 100 other stuff and is easy to miss; the idea with the warning was that we tell user that we are using a mpsd_release different than what was asked, it is so that the users are made aware of this rather than the fact that / is harmful (which is also no longer the case)

      • But the reason they get the slash is that they may use tab-completion to avoid having to type dev-23a. In that case, the error/warning message is frustrating: the trailing slash is not causing any harm, but the user is told off for using tab completion.

      • Please register or sign in to reply
Please register or sign in to reply
# root_dir is the place where this MPSD software instance has its root
root_dir = get_root_dir()
@@ -1274,14 +1279,6 @@ def main():
log_file,
)
# sanity check for common mistakes in command line arguments
if args.release.endswith("/"): # happens easily with autocompletion
logging.error(
f"You provided mpsd-release='{args.release}'. "
f"Did you mean '{args.release.removesuffix('/')}'?"
)
sys.exit(1)
# Check the command and run related function
if args.action == "remove":
remove_environment(args.release, root_dir, args.package_set)
Loading