From 5dd298003bfe6fcad6917b6e41bf4f9a7dbbcb9e Mon Sep 17 00:00:00 2001 From: Henning Glawe <glaweh@debian.org> Date: Mon, 17 Mar 2025 11:01:49 +0100 Subject: [PATCH] simplify main() code, missing directories are handled by called functions --- src/mpsd_hpc_tools/quota.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/mpsd_hpc_tools/quota.py b/src/mpsd_hpc_tools/quota.py index fb93889..2e0310d 100644 --- a/src/mpsd_hpc_tools/quota.py +++ b/src/mpsd_hpc_tools/quota.py @@ -160,19 +160,15 @@ def main(argv=None): user = args.user # 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_quota_line("#location", "size", "used", "avail", "use", raw=True) # print home quota + homedir = pathlib.Path("/home") / user print_quota_line(homedir, *df_mountpoint(homedir), raw=args.bytes) + # print scratch quota scratchdir = pathlib.Path("/scratch") / user - # only proceed if user has a directory on /scratch - if scratchdir.is_dir(): - print_quota_line(scratchdir, *df_ceph(scratchdir), raw=args.bytes) + print_quota_line(scratchdir, *df_ceph(scratchdir), raw=args.bytes) if __name__ == "__main__": -- GitLab