From fc09f5ce648d7d7b67b8a8c2eda46601da99bc40 Mon Sep 17 00:00:00 2001 From: Michael Z Date: Mon, 23 May 2022 13:51:32 -0400 Subject: [PATCH] Treat ppdc warnings as non-fatal Users have reported printers not working because of `ppdc` warning messages reported in the client (asking them to contact an administrator). These warnings do not result in non-zero return codes and are seemingly really just warnings, so no need to get users involved. Fixes #51 --- securedrop_export/export.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/securedrop_export/export.py b/securedrop_export/export.py index 1f8274037..ee7f2c520 100755 --- a/securedrop_export/export.py +++ b/securedrop_export/export.py @@ -128,7 +128,13 @@ def safe_check_call(self, command, error_message): try: subprocess.check_call(command) except subprocess.CalledProcessError as ex: - self.exit_gracefully(msg=error_message, e=ex.output) + # ppdc emits warnings which should not be treated as user facing errors + if ex.returncode == 0 and \ + ex.stderr is not None and \ + ex.stderr.startswith("ppdc: Warning"): + logger.info('Encountered warning: {}'.format(ex.output)) + else: + self.exit_gracefully(msg=error_message, e=ex.output) class ExportAction(abc.ABC):