Skip to content

Commit

Permalink
Improve logging of command output.
Browse files Browse the repository at this point in the history
  • Loading branch information
amanning9 committed Sep 11, 2024
1 parent e3caad6 commit f1d0101
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions jasmin_slurm_sync/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,14 @@ def add_user_to_account(self, account: str) -> None:
account,
)
else:
utils.run_ratelimited(args, capture_output=False, check=True)
cmd_output = utils.run_ratelimited(
args, capture_output=True, check=True
)
logger.info("Added user %s to account %s", self.username, account)
if cmd_output.stderr:
logger.error(cmd_output.stderr)
if cmd_output.stdout:
logger.debug(cmd_output.stdout)
else:
logger.info(
"Not adding %s to %s, because account is not managed.",
Expand All @@ -102,8 +108,14 @@ def remove_user_from_account(self, account: str) -> None:
account,
)
else:
utils.run_ratelimited(args, capture_output=False, check=True)
cmd_output = utils.run_ratelimited(
args, capture_output=True, check=True
)
logger.info("Removed user %s from account %s", self.username, account)
if cmd_output.stderr:
logger.error(cmd_output.stderr)
if cmd_output.stdout:
logger.debug(cmd_output.stdout)
else:
logger.debug(
"Not removing %s from %s, because account is not managed.",
Expand Down

0 comments on commit f1d0101

Please sign in to comment.