31 Commits

Author SHA1 Message Date
Samuele Pedroni
f2cdb6dd92 asserts,interfaces,snap: fix imports order (according to gci) 2021-06-14 20:54:41 +02:00
Alberto Mardegan
37e83765f3 asserts: fix errors reported by linter
Besides some trivial fixes, this also adds the (previously unused) class
`isUnacceptedUpdateSuite` to the tests suite.
2021-05-05 10:16:20 +03:00
Paweł Stołowski
eb65e1164e Add unit test. 2021-01-15 14:48:30 +00:00
Paweł Stołowski
8b8d548614 Implement and use byRevision sort for validation sets errors (thanks bboozzoo). 2021-01-14 15:31:10 +00:00
Pawel Stolowski
c80a2deabb Apply suggestions from code review
Add extra comments.

Co-authored-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2021-01-14 09:45:08 +01:00
Paweł Stołowski
d8ad77b1fd Tweak and add more comments (thanks pedronis). 2020-12-09 10:14:12 +01:00
Paweł Stołowski
e075910bd0 Fix handling of not installed cases when presence may be 'conflict', updated tests. 2020-12-08 11:34:33 +01:00
Paweł Stołowski
54758020ba Tweak error formatting (thanks pedronis). 2020-12-08 10:56:06 +01:00
Paweł Stołowski
0f5ad123b8 Print required revisions for snaps at wrong revsions. 2020-12-07 17:01:40 +01:00
Paweł Stołowski
565c104364 No need to create temporary SnapRef, rc is a SnapRef (thanks pedronis). 2020-12-07 16:34:22 +01:00
Paweł Stołowski
869c83b681 Tweaks to error format. 2020-12-07 16:30:08 +01:00
Paweł Stołowski
411d9c2eaf Use naming.SnapRef and SnapSet, handle local snaps, add error string. 2020-12-04 10:39:48 +01:00
Paweł Stołowski
7ae34dbd7a Rework ValidationSetsValidationError. 2020-12-03 18:19:33 +01:00
Paweł Stołowski
eea8c1cf9a Improve reporting of invalid/missing snaps. 2020-12-03 16:01:08 +01:00
Paweł Stołowski
04e34e79e1 Implement snapasserts.CheckInstalledSnaps(..) that validates installed snaps against validation sets. 2020-12-02 09:56:58 +01:00
Samuele Pedroni
45965b3abd a/snapasserts: fix typo in error msg
thanks @stolowski
2020-10-01 09:49:42 +02:00
Samuele Pedroni
98c725376c a/snapasserts: make snapContraints.conflict return a snapConflictsError
snapConflictsError maps revisions to keys of in-conflict validation-sets

and has an Error that does the final/lazy message formatting
2020-09-30 21:06:33 +02:00
Samuele Pedroni
d787654784 asserts/snapasserts: introduce ValidationSets
ValidationSets can hold a combination of validation-set assertions.

It will grow code to help applying such combinations.

For now it is able to detect conflicts among them.
2020-08-13 20:39:54 +02:00
Samuele Pedroni
ed98d07ab1 load/consume Core 20 seeds (aka recovery systems)
only non-dangerous features so far
2019-10-31 07:35:34 +01:00
Samuele Pedroni
43c69dd3e9 simplify things, fetch store assertion also when fetching snap-declaration to validate the snap 2018-09-27 21:01:38 +02:00
Maciej Borzecki
4e8bbe55d0 asserts/snapasserts: restore missing check
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2018-07-03 12:01:37 +02:00
Maciej Borzecki
6c2a881801 asserts/snapasserts: update CrossCheck() snap instance name handling
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2018-07-03 11:17:17 +02:00
Samuele Pedroni
97e3ef21a3 many: introduce asserts.NotFoundError replacing both ErrNotFound and store.AssertionNotFoundError (#3893)
This converts the singleton asserts.ErrNotFound to a richer asserts.NotFoundError struct carrying Type and optionally PrimaryKey, similar to store.AssertionNotFoundError which then gets folded with this.

This means code doesn't have to worry anymore which is which or to convert between the two. And when possible there is more information around. Though Backstores can continue to return minimal information (Type but not Headers in the new error).

A helper asserts.IsNotFound is also added to cover the simple old ==/!= asserts.ErrNotFound needs.

This also fixes/adjust some error handling to usually not repeat the richer information twice.
2017-09-12 16:34:53 +02:00
Samuele Pedroni
2d8a98c754 sanitize NewStoreStack signature, have shared default store test private keys 2017-08-18 18:38:21 +02:00
Michael Vogt
c5cec02c5f Automatically derive the side info in snap prepare-image for --extra-snaps
When `snap prepare-image` is used with --extra snaps the code will
now automatically contact the store and try to derive the side info
for the extra snaps automatically.

This makes it possible to do:
```
$ snap download core
$ snap prepare-image model.assert target-dir --extra-snaps core
```
and still have a non-sideloaded core snap.

The only downside of this approach is that the "contact" information
is missing.
2017-05-02 14:20:51 -04:00