Skip to content
Snippets Groups Projects
Commit 5dd29800 authored by Henning Glawe's avatar Henning Glawe
Browse files

simplify main() code, missing directories are handled by called functions

parent c9109851
No related branches found
No related tags found
No related merge requests found
...@@ -160,19 +160,15 @@ def main(argv=None): ...@@ -160,19 +160,15 @@ def main(argv=None):
user = args.user user = args.user
# check user exists # check user exists
homedir = pathlib.Path("/home") / user
if not homedir.is_dir():
sys.stderr.write(f"Home directory {str(homedir)} does not exist ({user=}).\n")
sys.exit(1)
# print header # print header
print_quota_line("#location", "size", "used", "avail", "use", raw=True) print_quota_line("#location", "size", "used", "avail", "use", raw=True)
# print home quota # print home quota
homedir = pathlib.Path("/home") / user
print_quota_line(homedir, *df_mountpoint(homedir), raw=args.bytes) print_quota_line(homedir, *df_mountpoint(homedir), raw=args.bytes)
# print scratch quota
scratchdir = pathlib.Path("/scratch") / user scratchdir = pathlib.Path("/scratch") / user
# only proceed if user has a directory on /scratch print_quota_line(scratchdir, *df_ceph(scratchdir), raw=args.bytes)
if scratchdir.is_dir():
print_quota_line(scratchdir, *df_ceph(scratchdir), raw=args.bytes)
if __name__ == "__main__": if __name__ == "__main__":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment