Add detailed logging to separate logfile #690
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Status
Ready for review
Description of Changes
Fixes #688
Makes our logging logic more flexible to configure multiple loggers that write to different logfiles, so
launcher.log
continues to be useful as a high level overview of all update events. Detailed information is written tolauncher-detail.log
, which is also rotated out after 10 copies.To enable this additional logging, this PR switches the relevant subprocess calls from
check_call
tocheck_output
. It distinguishes between success & error state, but logs in both cases.Testing
(Estimated wall time ~30 minutes, but mostly waiting.)
make clone
this branch intodom0
andsudo dnf reinstall
(ormake staging
if you don't have a previously provisioned environment) the freshly built RPM fromrpm-build/RPMS/noarch
.~/.securedrop_launcher/logs
so you can see the behavior with newly created log files.dom0
,mkdir /tmp/sdw-migrations && touch /tmp/sdw-migrations/potato
. This will force a fullsdw-admin --apply
run on the next update.dom0
, run/opt/securedrop/launcher/sdw-launcher.py --skip-delta 0
. This will force an updater run.~/.securedrop_launcher/logs
launcher-detail.log
contains output fromsudo qubesctl --show-output state.highstate
and fromsdw-admin --apply
/srv/salt/update-xfce-settings
and insert anecho XYZZY && exit 1
statement after theset
statements. This is how we'll cause all Salt runs to error out.launcher.log
contains error log entries pointing tolauncher-detail.log
launcher-detail.log
contains error logs containing the full Salt output and the XYZZY magic word we had the script insertChecklist
make flake8
) passes in the development environment (this box maybe left unchecked, as
flake8
also runs in CI)