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 <withnall@endlessm.com>
This commit is contained in:
Philip Withnall 2019-06-11 15:00:26 +01:00
parent af44861281
commit b14fa7b056
1 changed files with 6 additions and 4 deletions

View File

@ -216,12 +216,14 @@ def command_check(user, path, quiet=False, interactive=True):
noun = 'Path' noun = 'Path'
if is_allowed: if is_allowed:
print('{} {} is allowed by app filter for user {}'.format( if not quiet:
noun, path, user_id)) print('{} {} is allowed by app filter for user {}'.format(
noun, path, user_id))
return return
else: else:
print('{} {} is not allowed by app filter for user {}'.format( if not quiet:
noun, path, user_id)) print('{} {} is not allowed by app filter for user {}'.format(
noun, path, user_id))
raise SystemExit(EXIT_PATH_NOT_ALLOWED) raise SystemExit(EXIT_PATH_NOT_ALLOWED)