Skip to content
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

o/snapstate: fix validation sets restoring and snap revert on failed refresh #11826

Merged
merged 2 commits into from Jun 1, 2022

Conversation

stolowski
Copy link
Contributor

@stolowski stolowski commented May 27, 2022

The attempt to revert snaps in maybeRestoreValidationSetsAndRevertSnaps (in check-rerefresh, after partially successfull or failed refresh) would incorrectly conflict with own change, so revert wouldn't actually happen and check-rerefresh would report conflict error. This wasn't detected by the existing test due to insufficient mocking of the install change.

This PR passes own change around down to Revert (so conflict with own change gets ignored) and improves the test of actual revert. New tests cases for MaybeRestoreValidationSetsAndRevertSnaps are added to cover all special cases inside this function.

The related bug is https://bugs.launchpad.net/snapd/+bug/1974188 but I'm still not sure why check-rerefresh didn't report any error there (yet the system ended up in "invalid" enforcing state; there is likely another problem in this area).

maybeRestoreValidationSetsAndRevertSnaps() doesn't conflict with the
main change where check-rerefresh runs. Add more tests.
@stolowski stolowski force-pushed the validation-sets/fix-refresh-revert branch from 7fc34fc to 5e7b9f4 Compare May 27, 2022 09:50
@stolowski stolowski requested a review from pedronis May 27, 2022 09:50
@stolowski stolowski added the Needs Samuele review Needs a review from Samuele before it can land label May 27, 2022
@stolowski stolowski closed this May 27, 2022
@stolowski stolowski reopened this May 27, 2022
@stolowski stolowski added the Bug label May 27, 2022
overlord/snapstate/snapstate_update_test.go Outdated Show resolved Hide resolved
for sn := range verr.WrongRevisionSnaps {
wrongRevSnaps = append(wrongRevSnaps, sn)
}
logger.Debugf("refreshed snaps: %s, snaps at wrong revisions: %s", strutil.Quoted(refreshedSnaps), wrongRevSnaps)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should wrongRevSnaps also be quoted?

@stolowski stolowski added this to the 2.56 milestone May 31, 2022
Copy link
Collaborator

@pedronis pedronis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you

@mvo5 mvo5 added the Squash-merge Please squash this PR when merging. label Jun 1, 2022
@mvo5 mvo5 merged commit dfb37d3 into snapcore:master Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-picked Needs Samuele review Needs a review from Samuele before it can land Squash-merge Please squash this PR when merging.
Projects
None yet
4 participants