24 Commits

Author SHA1 Message Date
Alfonso Sánchez-Beato
64decd9d15 client: define components type 2024-06-18 18:31:42 +01:00
Philip Meulengracht
b6241ccf8a many: add support for user daemons in "snapctl services" (#13806)
* many: add support for user daemons in "snapctl services" by introducing the same --user/--global switches as "snap services"

* o/hookstate/ctlcmd: remove error messages

* cmd/snap,o/hookstate/ctlcmd: correct some doc strings
2024-04-12 13:32:52 +02:00
Philip Meulengracht
de453d009f many: move ServiceScopeOptions into clientutil and use in both client cases instead of having it duplicated 2024-03-14 19:18:24 +01:00
Zeyad Gouda
41512c4860 many: add "refresh-inhibited" select query to /v2/snaps
This select query allows only showing snaps that whose refresh
is inhibited.

* daemon: only show monitored snaps in "refresh-inhibited" select
* many: update refresh-inhibit-proceed-time field to refresh-inhibit in snaps api
* many: address review comments
* o/snapstate: export IsSnapMonitored
* o/snapstate: add doc comment for IsSnapMonitored
* daemon: check snap proceed time
* daemon: adjust proceed-time check
* client: update SnapRefreshInhibit.ProceedTime doc comment

Signed-off-by: Zeyad Gouda <zeyad.gouda@canonical.com>
2024-02-28 12:37:31 +01:00
Zeyad Gouda
98c6cbdab2 many: add refresh-inhibit-proceed-time field to snaps api
This field determines the time after which a pending refresh
is forced for a running snap in the next auto-refresh.

* many: prepare RefreshInhibitProceedTime for configurable max inhibition
* many: remove unneeded newline in RefreshInhibitProceedTime doc comment
* client/packages_test: test client snap with nil RefreshInhibitProceedTime
* client/packages_test: make TestClientSnap tests more readable
* many: precompute refreshInhibitProceedTime in aboutSnap
    This avoids locking/unlocking each snap to get RefreshInhibitProceedTime.
    We get the proceed time while already holding the lock.

Signed-off-by: Zeyad Gouda <zeyad.gouda@canonical.com>
2024-02-19 08:54:18 +01:00
Miguel Pires
29c9752d66 many: s/ioutil.WriteFile/os.WriteFile (#13217)
Replace ioutil.WriteFile with os.WriteFile since the former has been
deprecated since go1.16 and simply calls the latter.

Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
2023-09-26 11:38:46 +01: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
742f1fe219 many: correct struct fields and output key
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
2022-12-12 12:37:20 +01: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
Samuele Pedroni
179c58d54e many: expand fully handling links mapping in all components
to be backward compatible both in terms of what happens on a snapd revert or
dealing with data saved by an old snapd we still need to operate on the
fields/storage locations previously used for contact and website
2022-10-21 14:41:14 +02:00
Philip Meulengracht
48fb0e2b97 client/clientutil: review feedback
improve docstrings, add missing docstrings, use nil for serial when the assertion is not provided
2022-05-12 10:33:32 +02:00
Philip Meulengracht
56f17ad957 many: review feedback
move ModelAssertJSON, add additional unit test, add additional members to test models, rename and reorder parameters
2022-05-12 10:33:31 +02:00
Philip Meulengracht
49224a30dd client/clientutil: review feedback 2022-05-12 10:33:31 +02:00
Philip Meulengracht
1b232d0973 multiple: use a shared structure for ModelAssertJSON in asserts package.
review feedback
2022-05-12 10:33:31 +02:00
Philip Meulengracht
3fd3402b5a client/clientutil: initial review feedback
remove invalid comments, rewrite some, split out some of the YAML writer code to simplify the logic
2022-05-12 10:33:30 +02:00
Philip Meulengracht
275645c370 client/clientutil: remove special case handlings for JSON 2022-05-12 10:33:30 +02:00
Philip Meulengracht
3872649dc9 client/clientutil: review feedback
split out usage of serial/model assertations, add additional unit tests for serial assertions
2022-05-12 10:33:30 +02:00
Philip Meulengracht
4794eafbd8 client/clientutil: shared yaml/json formatter
for use in snapctl model and snap model commands
2022-05-12 10:33:29 +02:00
Michael Vogt
277eb06412 many: replace use of "sanity" with more inclusive naming
This commit replaces the use of "sanity" with more inclusive
naming.

When `sanity` is used in a more general sense either `validity`
or `quick` is used.
2022-03-14 18:22:34 +01:00
Samuele Pedroni
9242fb8256 many: turn Contact into an accessor
as later it will be derived from links and also we will have
to deal with links from store response vs snap.yaml
2021-06-25 19:10:08 +02:00
James Henstridge
2240e02324 cmd, client: move identification of user daemons to notes column 2021-02-24 18:00:51 +08:00
James Henstridge
69a0b28b0b client: expose "daemon-scope" property on apps 2021-02-08 12:52:14 +08:00
James Henstridge
5275d39dce client/clientutil: add "dbus-activated" as an AppInfo note 2021-01-27 20:56:53 +08:00
Samuele Pedroni
fc30cb67ec many: reorg cmd/snapinfo.go into snap and new client/clientutil (#9086)
To do the latter and disentangle the code from needing systemd all the time, this introduces o/servicestate/StatusDecorator.
2020-08-12 19:50:32 +02:00