From b14fa7b0561028fd2dba2bd263e7fdc1524d2c91 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 11 Jun 2019 15:00:26 +0100 Subject: [PATCH 1/2] malcontent-client: Implement --quiet for check subcommand When run with `--quiet`, the `check` subcommand will now print nothing. It continues to exit with an appropriate exit status. Signed-off-by: Philip Withnall --- malcontent-client/malcontent-client.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/malcontent-client/malcontent-client.py b/malcontent-client/malcontent-client.py index fac44d0..0d0ab38 100644 --- a/malcontent-client/malcontent-client.py +++ b/malcontent-client/malcontent-client.py @@ -216,12 +216,14 @@ def command_check(user, path, quiet=False, interactive=True): noun = 'Path' if is_allowed: - print('{} {} is allowed by app filter for user {}'.format( - noun, path, user_id)) + if not quiet: + print('{} {} is allowed by app filter for user {}'.format( + noun, path, user_id)) return else: - print('{} {} is not allowed by app filter for user {}'.format( - noun, path, user_id)) + if not quiet: + print('{} {} is not allowed by app filter for user {}'.format( + noun, path, user_id)) raise SystemExit(EXIT_PATH_NOT_ALLOWED) From 4051a0292a25f10a02fa0ed17b09ddab4fb20bbd Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 11 Jun 2019 15:01:08 +0100 Subject: [PATCH 2/2] malcontent-client: Implement --quiet for set subcommand While not entirely quiet on error, the `set` subcommand is now quieter. Signed-off-by: Philip Withnall --- malcontent-client/malcontent-client.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/malcontent-client/malcontent-client.py b/malcontent-client/malcontent-client.py index 0d0ab38..6544d3f 100644 --- a/malcontent-client/malcontent-client.py +++ b/malcontent-client/malcontent-client.py @@ -265,7 +265,8 @@ def command_set(user, allow_user_installation=True, __set_app_filter_or_error(user_id, app_filter, interactive) - print('App filter for user {} set'.format(user_id)) + if not quiet: + print('App filter for user {} set'.format(user_id)) def main():