-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add error handling for full state runs; fix apply_dom0 error handling #686
Conversation
728253f
to
e71fb58
Compare
MIGRATION_DIR = "potato" | ||
updater.run_full_install() | ||
calls = [["sdw-admin", "--apply"], ["sudo", "rm", "-rf", MIGRATION_DIR]] | ||
assert mock_call.has_calls(calls, any_order=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test never worked - has_calls
is the wrong method name, so it just runs an assertion against the mock that will always succeed, just like assert mock_call.nonsense()
would - thanks to unittest.mock.MagicMock
.
MIGRATION_DIR
is also not imported, so this will just create a local variable. We should IMO patch it rather than importing and modifying it (the rewritten test does so).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good find
MIGRATION_DIR = "potato" | ||
updater.run_full_install() | ||
calls = [["sdw-admin", "--apply"], ["sudo", "rm", "-rf", MIGRATION_DIR]] | ||
assert mock_call.has_calls(calls, any_order=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good find
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing
Fix for #668
- Install an RPM from this branch (either via
make staging
ordnf reinstall
of the built RPM aftermake clone
) - Ensure a migration flag is present in
/tmp/sdw-migrations
(this will be the case after an RPM install until Removes migration flag from postinst #667 is merged) - Modify your copy of
/usr/share/securedrop-workstation-dom0-config/scripts/provision-all
toexit 1
immediately - Run the updater with
/opt/securedrop/launcher/sdw-launcher.py --skip-delta 0
-
- Observe that the updater ultimately reports an error
Updater reports generic "Security updates failed" error message
-
- Observe that the
apply_all
error is logged in~/.securedrop_launcher/logs/launcher.log
- Observe that the
logs contained "Failed to apply full system state" and that "sdw-admin --apply" returned a non-zero exit status 1
-
- Observe that the migration flag is still present (i.e. the updater will try again)
- Undo your modification to
/usr/share/securedrop-workstation-dom0-config/scripts/provision-all
Fix for #685
- Install an RPM from this branch (either via
make staging
ordnf reinstall
of the built RPM after `make clone) - Remove
/tmp/sdw-migrations
if it exists - Modify your copy of
/srv/salt/update-xfce-settings
toexit 1
immediately - Run the updater with
/opt/securedrop/launcher/sdw-launcher.py --skip-delta 0
First I had a network error (oh the pain of waiting for the updater to run all the way through even though I knew it would error around the 5% mark)
-
- Observe that the updater ultimately reports an error
-
- Observe that the
apply_dom0
error is logged in~/.securedrop_launcher/logs/launcher.log
- Observe that the
- Undo your modification to
/srv/salt/update-xfce-settings
Status
Ready for review
Description of Changes
Fixes #668 (together with #684; will file separate issue for logging improvements)
Fixes #685
Testing
Fix for #668
make staging
ordnf reinstall
of the built RPM aftermake clone
)/tmp/sdw-migrations
(this will be the case after an RPM install until Removes migration flag from postinst #667 is merged)/usr/share/securedrop-workstation-dom0-config/scripts/provision-all
toexit 1
immediately/opt/securedrop/launcher/sdw-launcher.py --skip-delta 0
apply_all
error is logged in~/.securedrop_launcher/logs/launcher.log
/usr/share/securedrop-workstation-dom0-config/scripts/provision-all
Fix for #685
make staging
ordnf reinstall
of the built RPM after `make clone)/tmp/sdw-migrations
if it exists/srv/salt/update-xfce-settings
toexit 1
immediately/opt/securedrop/launcher/sdw-launcher.py --skip-delta 0
apply_dom0
error is logged in~/.securedrop_launcher/logs/launcher.log
/srv/salt/update-xfce-settings