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>
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>
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>
* 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
* 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
* 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
* 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>
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>