Skip to content

Commit

Permalink
Treat ppdc warnings as non-fatal
Browse files Browse the repository at this point in the history
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
  • Loading branch information
eaon committed May 23, 2022
1 parent 426fa2e commit fc09f5c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion securedrop_export/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit fc09f5c

Please sign in to comment.