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