59 Commits

Author SHA1 Message Date
Oliver Calder
4714253f45 features: add function to return info about feature flags
Add `All()` function, which returns a map of feature names to
`FeatureInfo` structs. `FeatureInfo` contains boolean values for whether
the feature is supported and whether it is enabled.

A new map is defined from feature flags to callback functions which
return true if the feature is supported and false if it is unsupported.
Any feature for which no callback function is defined is assumed to be
supported.

Currently, callback functions are defined for `QuotaGroups` (check that
systemd version >= 230), `UserDaemons` (check that user units are
supported), and `AppArmorPrompting` (always return false, for now).

Since some components of prompting are not yet merged into snapd master,
the experimental "apparmor-prompting" feature is not yet supported. This
commit adds a callback for "apparmor-prompting" which returns false and
states that it requires a newer version of snapd.

Once the rest of the prompting system is ready, the callback for
AppArmorPrompting should be modified to instead check that the installed
AppArmor has kernel and parser support for prompting, and that the
notify socket for communicating with the kernel exists.

Any features which are set to values other than true or false are
omitted from the map returned by `All()`.

Signed-off-by: Oliver Calder <oliver.calder@canonical.com>

features: add unsupported reason when feature not supported

Signed-off-by: Oliver Calder <oliver.calder@canonical.com>

features: improved docstrings for `All()` and `FeatureInfo`

Signed-off-by: Oliver Calder <oliver.calder@canonical.com>

features: adjusted callback feature unsupported reasons

Signed-off-by: Oliver Calder <oliver.calder@canonical.com>

features: add supported callback for apparmor prompting

Signed-off-by: Oliver Calder <oliver.calder@canonical.com>
2024-03-14 08:39:09 +01:00
Oliver Calder
76b5ebd805 features: add experimental.apparmor-prompting feature stub
Signed-off-by: Oliver Calder <oliver.calder@canonical.com>
2024-03-13 09:32:25 +01:00
Miguel Pires
4439f6d25d features: add count checks to ensure features are tested (#13518)
* features: ensure features are tested

Signed-off-by: Miguel Pires <miguel.pires@canonical.com>

* features: add quota group tests in features

Signed-off-by: Miguel Pires <miguel.pires@canonical.com>

---------

Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
2024-01-26 09:29:36 +01:00
Miguel Pires
5204d36625 features: add experimental feature flag for aspects
Add the aspects-configuration experimental flag and use it to gate
functionality in the CLI and API.

Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
2024-01-24 17:08:36 +00:00
Zeyad Gouda
5d39faeb9a features: add new feature (refresh-snap-awareness-ux)
Signed-off-by: Zeyad Gouda <zeyad.gouda@canonical.com>
2024-01-16 14:16:53 +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
Philip Meulengracht
41f96ad50f many: move memory,cpu and thread quota out of experimental (#12529)
* many: repurpose quota-groups experimental feature instead of introducing a new feature flag

* cmd/snap: unhide quota commands

* cmd/snap: add missing help categories for quota commands

* features: remove feature flag from tests

* features,o/servicestate: review feedback

Clarify the docs for the quota-groups feature. Be more specific in regards to the experimental helper text. Simplify function that checks for feature flag
2023-02-01 15:53:50 +01:00
Philip Meulengracht
af1860b2fb features,overlord/servicestate: add support for per-quota requirements (#11962)
* features,overlord/servicestate: add support for per-quota requirements

* overlord/servicestate: add unit tests for the new per-quota requirements

* overlord/servicestate: fix doc

* tests/main/snap-logs-journal: set new experimental flag for this test

* o/servicestate: fix tests after rebase, add additional changes to spread tests after new tests have been introduced

* t/core/persistent-journal-namespace: enable experimental journal quotas

* o/servicestate: allow the old quota-groups option, remove the changes to tests as that is not needed for this PR

* o/servicestate: review feedback

spelling mistake, remove wrong return revealed by test. (but is not hit in this PR due to redundant quota checks)

* multiple: review feedback

fix unit test run

* t/m/snap-quota-journal: try again, couldn't figure out the whitespace
2023-01-26 15:59:47 +01:00
Michael Vogt
06df81c76e many: revert "features: disable refresh-app-awarness by default again"
This reverts commit db339ccd37.

The desktop team is very nervous about disabling
refresh-app-awareness, especially this close to the release of
22.04.1. The worry is that unknown bugs during a refresh may
cause firefox to crash. Given the really good progress we had
with the startup performance and other improvements this would
be very unfortunate. Fwiw, there are no refresh bugs known right
now but the risk is there. The desktop team feels that the
shortcoming in the UX are a better tradeoff than to risk crashes.

We fixed the known issues around refresh-app-awareness:
https://bugs.launchpad.net/snapd/+bug/1975714
https://bugs.launchpad.net/snapd/+bug/1978834
https://github.com/snapcore/snapd/pull/11834
https://github.com/snapcore/snapd/pull/11976
https://github.com/snapcore/snapd/pull/11855

so hopefully this does not hit the other side of this too
hard. Sorry to everyone for yet another flip-flop on this,
it's really hard to find the right trade-off here.

This reverts https://github.com/snapcore/snapd/pull/11912
2022-07-26 12:36:24 +02:00
Michael Vogt
db339ccd37 features: disable refresh-app-awarness by default again
* features: disable refresh-app-awarness by default again

We enabled the `experimental.refresh-app-awareness` option right
before the 22.04 release [1]. However in hindsight this move was
premature. The UX is not quite ready, the refresh is stopped
but the experience should be that once the app is closed the
update gets applied which is not implemented yet. There are
also design issues with e.g. LXD as outlined in LP:#1978005
the need time and design to resolve. Another reason was the
automatic ~/snap -> ~/Snap folder migration. But this is
done differently now.

For the above reasons this commit changes the default again
to `refresh-app-awarness=false` until there is time to
fix the UX and the LXD issues.

[1] https://github.com/snapcore/snapd/pull/11566

* hookstate: disable refresh-app-awareness in gateAutoRefreshHookSuite.SetUpTest() - not strictly needed but when we enable refresh-app-awareness again it will help
2022-07-05 18:02:50 +02:00
Miguel Pires
dd32173b78 o/snapstate: minor simplifications
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
2022-06-13 09:34:20 +01:00
Miguel Pires
91bfc1efad features: add move snap home experimental feature
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
2022-06-09 09:40:24 +01:00
Pawel Stolowski
5a9eb56825 features: enable refresh-app-awareness by default
* Enable refresh-app-awareness by default.

* Update tests.

* Fix comment.

* Pass --ignore-running in spread tests.

* Update hidden-snap-dir test with --ignore-running.

* Fix op-remove-retry test to kill test-snapd-tools.block process.

* Remove --ignore-running flag from hidden-snap-dir (not needed).

* Remove --ignore-running flag from refresh test (not needed).

* Add comment to the test

Co-authored-by: Maciej Borzecki <maciek.borzecki@gmail.com>

* Add comment to the test

Co-authored-by: Maciej Borzecki <maciek.borzecki@gmail.com>

* Add extra comments explaining --ignore-running use in the tests.

Co-authored-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2022-04-21 09:00:05 +02:00
Miguel Pires
003247d4b7 cmd: use IsEnabled instead of Stat 2021-10-08 17:36:39 +01:00
Miguel Pires
a8f4b392ef many: s/SnapDataDir/SnapDataHomeDir/ 2021-10-04 15:10:55 +01:00
Miguel Pires
c734f653cb many: make naming more consistent 2021-09-29 12:33:20 +01:00
Miguel Pires
2c4d18eaf4 many: enable ~/.snap experimental feature 2021-09-23 23:51:36 +01:00
James Henstridge
88644518c5 Merge remote-tracking branch 'upstream/master' into enable-feature-dbus-activation 2021-05-27 13:33:45 +08:00
Michael Vogt
5603fbe09b features,servicestate: add experimental.quota-control flag
To allow us to still change he API we put resource groups
behind an experimental flag.
2021-04-29 20:35:46 +02:00
Paweł Stołowski
6d51527ddb Renamed refresh-control to gate-auto-refresh-hook. 2021-04-06 08:22:48 +00:00
Paweł Stołowski
bfc82b5fec Add refresh-control feature flag. 2021-04-06 08:22:48 +00:00
James Henstridge
926f7f7d67 features: enable dbus-activation feature by default 2021-03-18 19:12:25 +08:00
Zygmunt Krynicki
02e21d00eb features: enable classic-preserves-xdg-runtime-dir
We agreed to enable this feature after a release a long while ago and
forgot about this entirely. This should improve compatibility of some
snaps that use classic confinement, as $XDG_RUNTIME_DIR will no longer
be altered, allowing unmodified binaries to find sockets and other
resources there.

Forum: https://forum.snapcraft.io/t/classic-confinement-breaks-high-dpi-support/13868
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2020-10-30 13:28:12 +01:00
Paweł Stołowski
3c26bf46a6 Tweak order of featurs to match tests order (thanks zyga). 2020-09-04 14:55:32 +02:00
Paweł Stołowski
d7901881a0 Add feature flags for disk space awareness and disable disk checks by default. 2020-08-31 16:18:56 +02:00