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

Removes the trailing slash in mpsd_release if present, instead of throwing an error and exiting. We do write a warning that this is happening:

❯ mpsd-software install dev-23a/ foss2021a-mpi
[14:01:04] WARNING  Removed trailing slash from release: dev-23a                                 mpsd_software.py:1266
Release dev-23a is prepared in /home/karnada/Sandbox/Projects/mpsd-software-environments/dev-23a
Release dev-23a is prepared in /home/karnada/Sandbox/Projects/mpsd-software-environments/dev-23a
##### Setting up spack
Cloning into 'spack'...

Closes #22 (closed)

Edited by Ashwin Kumar Karnad

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
1261 1261 initialise_environment(Path(os.getcwd()))
1262 1262 sys.exit(0)
1263 1263
1264 # sanity check for common mistakes in command line arguments
1265 if args.release.endswith("/"): # happens easily with autocompletion
1266 args.release = args.release.removesuffix("/")
1267 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
  • merged

  • Hans Fangohr mentioned in commit e6e1939c

    mentioned in commit e6e1939c

  • Please register or sign in to reply
    Loading