1172 Commits

Author SHA1 Message Date
Alfonso Sánchez-Beato
ca4ffa568e daemon: support removing components 2024-07-10 07:49:52 -04:00
Miguel Pires
8128ed20bb many: rename aspect/bundle to view/registry
This changes the naming of the aspects feature to be "registry" instead
of bundle (i.e., a configuration space backed with its own storage) and
"view" instead of aspect. Once this lands, anyone that has this enabled
needs to unset the experimental flag and rename the state entry before
refreshing snapd and then re-enable.

Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
2024-06-17 17:16:57 +02:00
Oliver Calder
ecc68bf74e daemon,data/polkit: add polkit action for managing snap configuration
Adds `polkitActionManageConfiguration`.

Signed-off-by: Oliver Calder <oliver.calder@canonical.com>
2024-03-13 09:35:51 +01:00
alfonsosanchezbeato
0a375dc253 many: support sideloading components (#13454)
* daemon: support sideloading of components

* o/snapstate: check info in snap and component is coherent

Make sure that when we install a component it has been defined by the
owner snap and that the type is coherent betwee snap and component
metadata.

* cmd/snap: allow installation of local components

* tests/main: add spread test for components

* daemon: add component name to API data

* fixup! o/snapstate: check info in snap and component is coherent

* fixup! cmd/snap: allow installation of local components

* fixup! daemon: support sideloading of components

* fixup! tests/main: add spread test for components

* daemon: add helper for ErrorKindSnapNotInstalled errors

* fixup! daemon: support sideloading of components
2024-01-11 07:49:05 +00:00
Oliver Calder
38ec29b373 daemon: adjusted notices API to be compatible with snapd
As notices are originally from pebble, various adjustments must be made
in order for the ported API to work with snapd.

Signed-off-by: Oliver Calder <oliver.calder@canonical.com>
2023-12-06 16:09:03 -06:00
Miguel Pires
659d2d0b2a daemon: use transactions in aspect API
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
2023-06-29 10:46:17 +01:00
Miguel Pires
598df3621a daemon: add aspects endpoint to REST API
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
2023-06-13 17:36:48 +02:00
Robert Ancell
8bde56574a store: return categories in find results (#12513)
* store: Return categories in find results

This allows clients to show the categories as snapcraft.io does.

Fixes https://bugs.launchpad.net/snapd/+bug/1838786

* Remove unnecessary CategoryInfos type

* Only show categories when using --verbose

* Add tests for snap info printing categories

* Update cmd/snap/cmd_info.go

Co-authored-by: Miguel Pires <miguelpires94@gmail.com>

* Update cmd/snap/cmd_info.go

Co-authored-by: Miguel Pires <miguelpires94@gmail.com>

* v1 store API doesn't return categories

* Drop category information from snap info

Other snap commands don't support categories yet, this change should be part of that.

* Add /v2/categories and support /v2/find?category=foo

* Add note that section is deprecated

* Update client/packages.go

Co-authored-by: Miguel Pires <miguelpires94@gmail.com>

* Update daemon/api_categories.go

Co-authored-by: Miguel Pires <miguelpires94@gmail.com>

* Update daemon/api_categories.go

Co-authored-by: Miguel Pires <miguelpires94@gmail.com>

* Update daemon/api_categories.go

Co-authored-by: Miguel Pires <miguelpires94@gmail.com>

* Update store/store.go

Co-authored-by: Miguel Pires <miguelpires94@gmail.com>

* Update store/details_v2.go

Co-authored-by: Miguel Pires <miguelpires94@gmail.com>

* Update client/packages.go

Co-authored-by: Miguel Pires <miguelpires94@gmail.com>

* Improve test error message

* Drop copy/pasted comments that doesn't seem relevant

* Remove unused import

* Reorder CategoryInfo struct

* Fix accepted content type for store v2/snaps/categories request

* Set APILevel for v2/snaps/categories request

* Update accept string used to get data for store test

* Make /v2/categories return objects not just strings

---------

Co-authored-by: Miguel Pires <miguelpires94@gmail.com>
2023-04-06 10:02:09 +02:00
Miguel Pires
5b9f33bd89 daemon: expose user and gating holds at /v2/snaps/{name}
Exposes the longest hold placed by a gating snap and the user hold,
keyed by "gating-hold" and "user-hold", respectively.

Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
2022-12-12 12:37:20 +01:00
Miguel Pires
fdd74fa403 daemon: support refresh hold/unhold in API
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
2022-10-17 21:55:15 +02:00
Miguel Pires
1f2ab20c4c o/snapstate: auto-resolve validation set enforcement constraints
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
2022-09-29 11:41:22 +01:00
Miguel Pires
af2750d0a4 o/assertstate: add all used sets to ValidationSetsValidationError
Include all validation sets used to check in the validation error
instead of wrapping error with additional information.

Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
2022-09-27 17:10:18 +01:00
Miguel Pires
73484a1523 asserts: wrap validation error with new sets data
Wrap the error returned by CheckInstalledSnaps with the new sets
that are not currently tracked. The previous approach required
marking those sets as "extra" in the validation set but was out
of place since this is only required for callers of "TryEnforce" to
resolve constraints that led to the validation error

Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
2022-09-26 17:17:46 +01:00
Miguel Pires
5c42708c8c daemon: support validation set refresh+enforce in API
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
2022-09-23 15:43:31 +01:00
Paweł Stołowski
51f2364751 Implement api handler for refresh with validation sets (i.e. for `snap
validate --enforce --refresh ...`. The two critical functions
(snapstate.EnforceSnaps and assertstate.TryEnforceValidationSets are
still stubs).
2022-06-23 09:27:00 +02:00
James Henstridge
681be6c2a7 daemon: add a /v2/accessories/changes/{ID} endpoint
* daemon: add an API endpoint to get changes associated with theme installs.

We don't want to expose the full set of /v2/changes/* endpoints to
snaps, so this provides read-only information about changes initiated
via the theme installation API.

* tests: test that the /v2/accessories/changes API works

* daemon: move /v2/accessories/changes endpoint to its own file

* daemon: add a TODO note about the access control on /v2/accessories/changes
2022-04-01 09:25:07 +02:00
Michael Vogt
9e0968e388 Merge pull request #11134 from MiguelPires/daemon-sideload-many
daemon: add multiple snap sideload to API
2021-12-08 14:53:37 +01:00
Paweł Stołowski
3af4a66c6f Fix format 2021-12-03 15:45:05 +01:00
Paweł Stołowski
ba66aa3df6 Restore validation sets tracking in the daemon after an early error from
UpdateMany.
2021-12-03 15:45:05 +01:00
Miguel Pires
d8f536a3ce daemon: add multiple snap sideload to API 2021-12-01 15:51:48 +00:00
Miguel Pires
a5068a4dd3 daemon: rename form fields 2021-11-18 10:42:59 +00:00
Miguel Pires
e77052e696 daemon: write formdata file parts to snaps dir
The multipart stdlib writes formdata file parts (above a limit) to
/tmp and that could exceed the available space on devices using tmpfs.
The files would then be copied from /tmp to /var/lib/snapd/snaps.
This change adds a custom form reader that reads non-file parts into
memory and writes file parts directly to /var/lib/snapd/snaps.

https://bugs.launchpad.net/snapd/+bug/1950190
2021-11-12 15:04:57 +00:00
Paweł Stołowski
3761562ab9 Rename RefreshAssertions to RefreshSnapAssertions. 2021-08-30 10:03:55 +02:00
Paweł Stołowski
5681d09488 Introduce assertstate.RefreshAssertions(..) that refreshes both snap
declarations and validation set assertions.
2021-08-30 10:03:54 +02:00
Samuele Pedroni
bb7eaf9dfb Merge remote-tracking branch 'upstream/master' into daemon-access-check 2021-05-19 17:57:13 +02:00