33 Commits

Author SHA1 Message Date
Zeyad Yasser
54c6a1d8c3 refactor: replace IsNotFound usages for errors.Is(err, &NotFoundError{}) 2023-02-09 16:02:40 +00:00
Ian Johnson
8150796546 asserts/assertstest: line-wrap some doc-comments
Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2021-02-11 16:03:09 -06:00
Samuele Pedroni
d7479b55d1 many: rename MakeRandomString to just RandomString 2020-02-03 19:02:21 +01:00
Samuele Pedroni
38e08b845c many: drop and replace strutil.MakeRandomString as appropriate 2020-02-03 14:43:35 +01:00
Samuele Pedroni
1e5c811d3f introduce remodel kinds and contexts
different context implementations will be used depending on the kind
of remodel, and those will play the roles/implement as needed
snapstate.DeviceContext, storecontext.DeviceBackend and
registrationContext:

* same brand/model, brand store => updateRemodel
  this is just a contextual carrier for the new model

* same brand/model different brand store => storeSwitchRemodel this
  mediates access to device state kept on the remodel change, it also
  create a store that uses that and refers to the new brand store

* different brand/model, maybe different brand store => reregRemodel
  similar to storeSwitchRemodel case after a first phase that performs
  re-registration where the context plays registrationContext's role
  (NOT IMPLEMENTED YET)
2019-05-23 14:43:38 +02:00
Samuele Pedroni
781da36d78 introduce assertstest.SigningAccounts has a streamlined to setup
brands/signing accounts in tests, typically and often to sign models

start converting most model signing in tests to this (or to
FakeAssertion)
2019-05-09 08:51:05 +02:00
Samuele Pedroni
8d533aaa90 introduce assertstest.AddMany and assertsstatetest.AddMany helpers
start using them
2019-05-09 08:51:05 +02:00
Samuele Pedroni
707e84588a introduce assertstest.FakeAssertion*, use it in snapstate tests
now that device context etc can bypass the assertion db faking model
assertions should be more generally applicable
2019-05-08 14:36:38 +02:00
Samuele Pedroni
3c5f9613b6 many: switch to account validation: unproven|verified (#5419) 2018-06-28 08:56:48 +02:00
Samuele Pedroni
0ce4b624ca this was still using the hardcoded value instead of the keys config one 2017-11-08 18:29:23 +01: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
b8a7cf7c4a overlord: always try to get a serial, lazily on classic (#3573)
Always try to get a serial even on classic, but if there is no gadget nor no non-default store wait until some snaps are installed or being installed, use the hard coded 'generic/generic-classic' model as fallback for the cases where there is no model/seeding data.
2017-08-30 23:45:13 +02:00
Samuele Pedroni
2d8a98c754 sanitize NewStoreStack signature, have shared default store test private keys 2017-08-18 18:38:21 +02:00
Samuele Pedroni
c955836422 fix master 2017-08-16 20:12:50 +02:00
Samuele Pedroni
c733ce830b address review feedback (thanks atomatt) 2017-08-14 14:06:40 +02:00
Samuele Pedroni
a9f2339044 support 'generic' authority 2017-08-12 16:26:01 +02:00
Samuele Pedroni
938e6b61d0 asserts,interfaces/builtin,overlord/assertstate: introduce base-declaration (#2037)
This introduces a base-declaration assertion with the default policies (for now about interfaces) that govern all snaps.

This has the assertion definition itself, the first pass at plumbing to have the content defined in interfaces/builtin, while the forward compatible (with the idea to revision/distribute this through the store) interface to it is asserstate.BaseDeclaration.

The assertion is not used yet in any way.
2016-09-30 18:26:36 -03:00
Matt Goodall
14f6d3d7a6 Give test account-key asserts a name.
New account-key asserts will have a "default" name unless explicitly
overridden. The StoreStack uses "root" and "store" for its two asserts.
2016-09-07 13:33:39 +01:00
Colin Watson
a0d3d55461 Explicitly prefer GnuPG 1 2016-08-24 16:18:29 +01:00
Samuele Pedroni
07aba0129f simplify the Database.ImportyKey/PublicKey interface now that key id are really assumed to be globally unique 2016-08-21 19:57:10 +02:00
Samuele Pedroni
f734c781a6 default to in-memory implementation for the keypair mgr 2016-08-21 19:57:10 +02:00
Samuele Pedroni
1bd6ee1388 switch fixed pub key timestamp to 2016 Jan 1 2016-08-11 18:51:21 +02:00
Samuele Pedroni
af56725f31 key hash -> simply key id as before 2016-08-11 16:49:56 +02:00
Samuele Pedroni
9c10672cc1 lookup keys by sign-key-sha3-384 and related changes 2016-08-02 16:00:07 +02:00
Samuele Pedroni
6b8aedc036 format changes for public keys, signature trailer, remove fingerprint from account-key, compute sha3_384 of public keys 2016-08-01 21:59:14 +02:00