-
Notifications
You must be signed in to change notification settings - Fork 582
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/registrystate: support snapctl get --pristine #14552
o/registrystate: support snapctl get --pristine #14552
Conversation
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #14552 +/- ##
==========================================
+ Coverage 78.85% 78.87% +0.01%
==========================================
Files 1079 1082 +3
Lines 145615 146054 +439
==========================================
+ Hits 114828 115200 +372
- Misses 23601 23655 +54
- Partials 7186 7199 +13
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Changes look really good, Thank you!
I am curious about the intended use case for a snap to use --pristine
? can't a snap just get a copy of the view data before adding changes to the transaction and get the same data?
It would be great to have comment that explains why we have it.
A snap might be deciding whether to allow changes made by another snap, in which case it might be useful to know what was the previous state and there would be no other way of getting this data. Even if it's the same snap, several hooks are called in different stages so the snap would have to retain that data in the snap and access it across different hooks |
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
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.
Thanks, this looks good!
Support
snapctl get --pristine ...
which allows snaps to read the state of the view disregarding the pending changes in the current transaction. Includes a small refactor to the registrystate functions that was necessary.